List of usage examples for org.springframework.security.core.userdetails User User
public User(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities)
User
with the details required by org.springframework.security.authentication.dao.DaoAuthenticationProvider . From source file:org.tangram.spring.security.AnyNameUserService.java
/** * Return user details instance for username. * * @param name/*from ww w .j a v a 2 s. c o m*/ * @return user instance valid for any condition containing just the name * @throws UsernameNotFoundException */ @Override public UserDetails loadUserByUsername(String name) throws UsernameNotFoundException { Collection<GrantedAuthority> grants = new HashSet<>(); return new User(name, "", true, true, true, true, grants); }
From source file:SpringSecurity.UserService.java
@Override public UserDetails loadUserByUsername(String string) throws UsernameNotFoundException { Students student = StudentDAO.getStudent(string); if (student != null) { if (student.getLoggedin()) { throw new UsernameNotFoundException("User Logged In"); }//w ww .j a v a 2s.c o m List roles = new ArrayList(); roles.add(new SimpleGrantedAuthority("ROLE_USER")); return new User(student.getEmail(), student.getPassword(), true, true, true, true, roles); } Admins admin = AdminDAO.getAdmin(string); if (admin != null) { if (admin.getLoggedin()) { throw new UsernameNotFoundException("User Logged In"); } List roles = new ArrayList(); roles.add(new SimpleGrantedAuthority("ROLE_ADMIN")); return new User(admin.getEmail(), admin.getPassword(), true, true, true, true, roles); } throw new UsernameNotFoundException("User not found"); }
From source file:quanlyhocvu.api.web.controller.authority.CustomUserDetailService.java
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { UserDTO user = mongoService.loadUserByUserName(username); UserDetails userdetail = new User(user.getUsername(), user.getPassword(), user.isEnabled(), true, true, user.isNonlocked(), getAuthorities(user)); return userdetail; }
From source file:org.kuali.mobility.mdot.userdetails.MobileUserDetailsService.java
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { List<GrantedAuthorityImpl> list = new ArrayList<GrantedAuthorityImpl>(); list.add(new GrantedAuthorityImpl("ROLE_USER")); UserDetails user = new User(username, "", true, true, true, true, list); return user;/*from www .j a va 2s. co m*/ }
From source file:de.tudarmstadt.ukp.csniper.webapp.security.AnyUserDetailsService.java
@Override public UserDetails loadUserByUsername(String aUsername) throws UsernameNotFoundException, DataAccessException { return new User(aUsername, aUsername, true, true, true, true, asList(new GrantedAuthorityImpl("ROLE_USER"))); }
From source file:com.tcloud.bee.key.server.service.impl.DummyUserDetailsServiceImpl.java
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { logger.info("username:{}", username); return new User(username, "notUsed", true, true, true, true, AuthorityUtils.createAuthorityList("ROLE_USER")); }
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:ca.qhrtech.security.BGLAuthenticationConfiguration.java
private UserDetailsService userDetailsService() { return (String username) -> { BGLUser user = userRepository.findByUsername(username); if (user != null) { return new User(user.getUsername(), user.getPassword(), true, true, true, true, AuthorityUtils.createAuthorityList("USER")); } else {//from w w w .j av a2 s . co m throw new UsernameNotFoundException("Could not find the user: " + username); } }; }
From source file:exanpe.t5.lib.demo.security.SameUserPasswordAP.java
public Authentication authenticate(Authentication authentication) throws AuthenticationException { String username = authentication.getName(); GrantedAuthorityImpl ga = new GrantedAuthorityImpl("ROLE_" + username); List<GrantedAuthority> l = new ArrayList<GrantedAuthority>(); l.add(ga);//from w ww .j a v a 2s. com return new UsernamePasswordAuthenticationToken(new User(username, username, true, true, true, true, l), username, l); }
From source file:de.thm.arsnova.CasUserDetailsService.java
@Override protected UserDetails loadUserDetails(final Assertion assertion) { final List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>(); grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_USER")); return new User(assertion.getPrincipal().getName(), "", true, true, true, true, grantedAuthorities); }