/**
* {@inheritDoc}
*/
@Override
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
String password = authentication.getCredentials().toString();
UserDetails existingUser;
try {
ResponseEntity<Collection<? extends GrantedAuthority>> authenticationResponse = authenticationDelegate.authenticate(username, password.toCharArray());
if (authenticationResponse.getStatusCode().value() == 401) {
throw new BadCredentialsException(messages.getMessage(
"AbstractUserDetailsAuthenticationProvider.badCredentials",
"Bad credentials"));
}
existingUser = new User(username, password, authenticationResponse.getBody());
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
throw new AuthenticationServiceException(ex.getMessage(), ex);
}
return existingUser;
}
HttpAuthenticationProvider.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:webworms
作者:
评论列表
文章目录