org.springframework.security.cas.authentication.CasAssertionAuthenticationToken Java Examples
The following examples show how to use
org.springframework.security.cas.authentication.CasAssertionAuthenticationToken.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomUserDetailsService.java From demo-spring-security-cas with Apache License 2.0 | 6 votes |
@Override public UserDetails loadUserDetails(CasAssertionAuthenticationToken token) throws UsernameNotFoundException { String login = token.getPrincipal().toString(); String lowercaseLogin = login.toLowerCase(); log.debug("Authenticating '{}'", login); List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>(); if (admins != null && admins.contains(lowercaseLogin)) { grantedAuthorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ADMIN)); } else { grantedAuthorities.add(new GrantedAuthority() { private static final long serialVersionUID = 1L; @Override public String getAuthority() { return AuthoritiesConstants.USER; } }); } return new AppUserDetails(lowercaseLogin, grantedAuthorities); }
Example #2
Source File: CasUserDetailService.java From cymbal with Apache License 2.0 | 5 votes |
@Override public UserDetails loadUserDetails(CasAssertionAuthenticationToken token) throws UsernameNotFoundException { String userName = token.getName(); if (userRoleProcessService.isAdmin(userName)) { return new User(userName, Constant.Strings.EMPTY, AuthorityUtils.createAuthorityList(UserRole.ADMIN.getValue())); } else { return new User(userName, Constant.Strings.EMPTY, AuthorityUtils.NO_AUTHORITIES); } }
Example #3
Source File: SecurityConfiguration.java From demo-spring-security-cas with Apache License 2.0 | 4 votes |
@Bean public AuthenticationUserDetailsService<CasAssertionAuthenticationToken> customUserDetailsService() { return new CustomUserDetailsService(adminList()); }