HibernateAuthenticationProvider.java 文件源码

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

项目:interview-preparation 作者:
/**
 * Retrieve user.
 *
 * @param username
 *            the username
 * @param authentication
 *            the authentication
 * @return the user details
 * @throws AuthenticationException
 *             the authentication exception
 */
@Override
protected UserDetails retrieveUser(final String username, final UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {

    UserDetails loadedUser;

    if (username == null || username.trim().length() < 1) {
        throw new AuthenticationServiceException(authenticationServiceExcep);
    }

    try {

        System.out.println(authenticationService);
        loadedUser = authenticationService.loadUserByUsername(username);

    } catch (final DataAccessException repositoryProblem) {

        throw new AuthenticationServiceException(authenticationServiceExcep);
    }

    if (loadedUser == null) {
        throw new AuthenticationServiceException(badCredentialExcep);
    }
    return loadedUser;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号