봄 보안 - 로그인 显示 [잘못된 자격 증명]

문제 설명

또는

org.springframework.security.authentication.BadCredentialsException: Bad credentials。

 

분석

A, 사용자 이름 또는 비밀번호 오류

기본적으로 관계없이 사용자 이름이 존재하지 않거나 암호가 잘못, 봄 보안 보고서합니다 잘못된 자격 증명 예외 정보, 비현실적인 특정 오류가 발생했습니다.

출처 :

org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider

try { 
    user = retrieveUser(username, (UsernamePasswordAuthenticationToken) authentication); 
} catch (UsernameNotFoundException notFound) { 
    logger.debug("User '" + username + "' not found"); 
 
    if (hideUserNotFoundExceptions) { 
        throw new BadCredentialsException(messages.getMessage( 
                "AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials")); 
    } else { 
        throw notFound; 
    } 
}

둘째, 액세스는 충분하지 않습니다

셋째, 암호화 된 암호 문제

비밀번호 암호화 문제에 대한 다음과 같은 수 있습니다 :

1. 암호화 된 암호를 첨가해야한다 {무 조작은}, 암호 API를하기 전에 공식 구체적인 이유를 참조하시기 바랍니다

User user = new User(userInfo.getUsername(),"{noop}"+ userInfo.getPassword(),getAuthority(userInfo.getRoles()));

2. 암호화 구성 파일이 아닌 암호의 서비스의 응용 프로그램들은

하여 데이터베이스 (3)에 대비에 대한 사용자, 암호화 알고리즘, 그리고 봄 보안 구성이 동일 할 때 사용되는 암호화 알고리즘에.

솔루션

분석, 문제를 참조하십시오.

참조 기사

https://blog.csdn.net/qq_37252930/article/details/95723940

https://blog.csdn.net/qq_41950229/article/details/98479327

https://www.cnblogs.com/jifeng/archive/2012/06/09/2542928.html

https://blog.csdn.net/weixin_44580977/article/details/98491875

출시 1423 원저 · 원 찬양 260 · 전망 420 000 +

추천

출처blog.csdn.net/weixin_43272781/article/details/104720600