コード例 #1
0
ファイル: BaseTest.java プロジェクト: nujev/mateo-1
 public Authentication authenticate(
     UserDetails principal, String credentials, List<GrantedAuthority> authorities) {
   Authentication authentication =
       new TestingAuthenticationToken(principal, credentials, authorities);
   authentication.setAuthenticated(true);
   SecurityContextHolder.getContext().setAuthentication(authentication);
   return authentication;
 }
コード例 #2
0
 @Override
 public Authentication authenticate(Authentication authentication) throws AuthenticationException {
   UserDetails details = (UserDetails) authentication.getPrincipal();
   if (details.getPassword() == null || details.getPassword().isEmpty()) {
     authentication.setAuthenticated(true);
   }
   final Collection<SimpleGrantedAuthority> authorities =
       (Collection<SimpleGrantedAuthority>) authentication.getAuthorities();
   authorities.clear();
   authorities.add(new SimpleGrantedAuthority("NOT_VALIDATED"));
   return authentication;
 }
コード例 #3
0
 public Authentication authenticate(Authentication authentication) throws AuthenticationException {
   logger.info("authenticate() enter: " + authentication);
   Authentication result = authentication;
   if (useAuthCopy)
     result =
         new UsernamePasswordAuthenticationToken(
             authentication.getPrincipal(),
             authentication.getCredentials(),
             authentication.getAuthorities());
   if (!result.isAuthenticated()) result.setAuthenticated(true);
   logger.info("authenticate() finished: " + result);
   return result;
 }