@Override protected SSOUser doAuthenticate( UsernamePasswordAuthRequestInfoAuthenticationToken authRequest, String username, String password) { SSOUser ssoUser = ssoService.authenticate(username, password, authRequest.getAuthRequestInfo()); return ssoUser; } }
public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (authentication instanceof UsernamePasswordAuthRequestInfoAuthenticationToken) { UsernamePasswordAuthRequestInfoAuthenticationToken authRequest = (UsernamePasswordAuthRequestInfoAuthenticationToken) authentication; if (authRequest.getCredentials() == null) { throw new BadCredentialsException("Null credentials"); } SSOUser ssoUser = ssoService.authenticate(authRequest.getName(), authRequest.getCredentials().toString(), authRequest.getAuthRequestInfo()); if (ssoUser == null) { throw new BadCredentialsException("Bad credentials"); } if (ssoUser.getActionsMap().isEmpty()) { throw new BadCredentialsException("No roles"); } return createAuthentication(ssoUser); } return null; }