UserDetailsAuthenticationProviderImpl.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:spring-backend-boilerplate 作者:
/**
 * Implementation of an abstract method defined in the base class. The
 * retrieveUser() method is called by authenticate() method of the base
 * class. The latter is called by the AuthenticationManager.
 */
@Override
protected final UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication)
        throws AuthenticationException {
    UserDetails details;
    try {
        details = this.getUserDetailsService().loadUserByUsername(username);
        authentication.setDetails(details);
    }
    catch (DataAccessException repositoryProblem) {
        throw new AuthenticationServiceException(repositoryProblem.getMessage(), repositoryProblem);
    }

    if (details == null) {
        throw new AuthenticationServiceException(
                "UserDetailsService returned null, which is an interface contract violation");
    }
    return details;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号