2011-02-16 5 views
0

봄 보안 3.0.5.RELEASE에서는 BadCredentialsException을 잘못된 암호로 catch하기 위해 어떤 클래스와 메서드를 재정의 할 수 있습니다. 여기 내 security.xml잘못된 암호를 얻기 위해 재정의 할 스프링 보안

<beans:bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider"> 
    <beans:property name="hideUserNotFoundExceptions" value="true" /> 
    <beans:property name="userDetailsService" ref="userDao"/> 
    <beans:property name="passwordEncoder" ref="passwordEncoder"/> 
</beans:bean> 

<security:authentication-manager> 
    <security:authentication-provider ref='daoAuthenticationProvider'/> 
</security:authentication-manager> 

답변

0

서브 클래스 SimpleUrlAuthenticationFailureHandler의 조각과 onAuthenticationFailure를 오버라이드 (override)(). 그것은 예외가 전달되도록합니다. exception.getAuthentication(). getCredentials()는 시도한 암호를 반환합니다.

형태-로그인 요소에 AuthenticationFailureHandler을 구성

<form-login authentication-failure-handler-ref="authenticationFailureHandler" />