request.getSession().setAttribute(WebAttributes.AUTHENTICATION_EXCEPTION, exception);
}
private ClientAuthenticationToken getAuthenticationTokenWithUserDetails(Authentication authentication) {
Collection<? extends GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
ClientAuthenticationToken token = getAuthenticationToken(authentication);
if (token != null) {
UserDetails userDetails = pac4jUserDetailsService.loadUserDetails(token);
if (userDetails != null) {
this.userDetailsChecker.check(userDetails);
authorities = userDetails.getAuthorities();
}
ClientAuthenticationToken result = new ClientAuthenticationToken((Credentials) token.getCredentials(),
token.getClientName(), token.getUserProfile(), authorities);
result.setDetails(userDetails);
return result;
}
return null;
}