Package org.andromda.timetracker.web.security

Source Code of org.andromda.timetracker.web.security.UserDetailsServiceImpl

package org.andromda.timetracker.web.security;

import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UserDetailsService;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.andromda.timetracker.service.SecurityService;
import org.andromda.timetracker.ServiceLocator;
import org.andromda.timetracker.vo.UserDetailsVO;
import org.springframework.dao.DataAccessException;

public class UserDetailsServiceImpl implements UserDetailsService {

    public UserDetails loadUserByUsername(String username)
            throws UsernameNotFoundException, DataAccessException {

      SecurityService service = ServiceLocator.instance().getSecurityService();
        UserDetailsVO userDetailsVO = service.getUserDetails(username);
        if (userDetailsVO == null) {
            throw new UsernameNotFoundException("User " + username + " not found");
        }
        return new UserDetailsImpl(userDetailsVO);
    }
}
TOP

Related Classes of org.andromda.timetracker.web.security.UserDetailsServiceImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.