Example usage for org.springframework.security.core.userdetails User getPassword

List of usage examples for org.springframework.security.core.userdetails User getPassword

Introduction

In this page you can find the example usage for org.springframework.security.core.userdetails User getPassword.

Prototype

public String getPassword() 

Source Link

Usage

From source file:com.qpark.eip.core.spring.security.EipUserDetailsService.java

/**
 * @param userDetailService//  w  ww. j a v a  2 s.  c  om
 * @param userName
 * @return
 */
public static boolean setSecurityContextHolderAuthentication(final EipUserProvider userDetailService,
        final String userName) {
    boolean doLogin = SecurityContextHolder.getContext().getAuthentication() == null;
    if (doLogin) {
        User user = userDetailService.getUser(userName);
        SecurityContextHolder.getContext()
                .setAuthentication(new UsernamePasswordAuthenticationToken(user, user.getPassword()));
    }
    return doLogin;
}

From source file:org.runway.utils.AuthenticationUtils.java

public static void autoLogin(User user, HttpServletRequest request,
        AuthenticationManager authenticationManager) {

    //           GrantedAuthority[] grantedAuthorities = new GrantedAuthority[] { new GrantedAuthorityImpl(
    //             user.getAuthority()) };

    UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user.getUsername(),
            user.getPassword(), user.getAuthorities());

    // generate session if one doesn't exist
    HttpSession session = request.getSession();

    token.setDetails(new WebAuthenticationDetails(request));
    Authentication authenticatedUser = authenticationManager.authenticate(token);

    SecurityContextHolder.getContext().setAuthentication(authenticatedUser);
    // setting role to the session
    session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY,
            SecurityContextHolder.getContext());

}

From source file:com.orchestra.portale.externalauth.FbAuthenticationManager.java

private static User fbUserCheck(String userFbId, String userFbMail, UserRepository userRepository)
        throws UserNotFoundException {
    // Recupera i dati dell'utente userServiceId dal repository 
    com.orchestra.portale.persistence.sql.entities.User domainUser = userRepository
            .findByFbEmailOrFbUser(userFbMail, userFbId);

    if (domainUser == null || domainUser.getUsername() == null || "".equals(domainUser.getUsername())) {
        throw new UserNotFoundException();
    }//from  w w  w  .  j a v a 2s . co m

    boolean enabled = true;
    boolean accountNonExpired = true;
    boolean credentialsNonExpired = true;
    boolean accountNonLocked = true;

    User user = new User(domainUser.getUsername(), domainUser.getPassword().toLowerCase(), enabled,
            accountNonExpired, credentialsNonExpired, accountNonLocked, getAuthorities(domainUser.getRoles()));

    return user;
}

From source file:net.seedboxer.web.security.SeedBoxerUserDetails.java

public SeedBoxerUserDetails(net.seedboxer.core.domain.User user) {
    super(user.getUsername(), user.getPassword(), createAuthorities(user));
    this.user = user;
}

From source file:com.qpark.eip.core.spring.auth.DatabaseSecurementProvider.java

/**
 * @see com.qpark.eip.core.spring.security.DefaultEipSecurmentPropertyProvider#getSecurementPassword()
 *//*from   w  ww .  j  a v  a2 s .c o  m*/
@Override
public String getSecurementPassword() {
    User user = this.databaseUserProvider.getUser(this.getSecurementUsername());
    return user.getPassword();
}

From source file:com.klm.workshop.security.CustomUserDetails.java

/**
 * Construct user with authorities/*w  ww  . j ava  2  s  .co  m*/
 * 
 * @param user The current user
 * @param roles The current user's roles
 */
public CustomUserDetails(com.klm.workshop.model.User user, List<GrantedAuthority> roles) {
    super(user.getEmail(), user.getPassword(), user.isEnabled(), true, true, true, roles);
    this.user = user;
}

From source file:com.example.server.user.CustomUserDetailsService.java

private org.springframework.security.core.userdetails.User createUser(User account) {
    return new org.springframework.security.core.userdetails.User(account.getUsername(), account.getPassword(),
            Collections.singleton(createAuthority(account)));
}

From source file:com.saresh.labsproject.security.LPUserDetailsService.java

private UserDetails buildUserForAuthentication(com.saresh.labsproject.entity.User user,
        List<GrantedAuthority> authorities) {
    return new User(user.getLogin(), user.getPassword(), user.isEnabled(), true, true, true, authorities);
}

From source file:co.edu.utb.softeng.springtodos.service.security.MyUserDetailsService.java

private User buildSpringUser(co.edu.utb.softeng.springtodos.entity.security.User user,
        List<GrantedAuthority> authorities) {
    return new User(user.getUsername(), user.getPassword(), user.isEnabled(), true, true, true, authorities);
}

From source file:com.mysample.springbootsample.security.CustomUserDetailsService.java

private User buildUserForAuthentication(com.mysample.springbootsample.domain.User user,
        List<GrantedAuthority> authorities) {

    return new User(user.getUsername(), user.getPassword(), true, true, true, true, authorities);
}