우리는 AuthenticationProvider를 통해 맞춤 인증을 구현하는 webapp가 있습니다. 이제 제대로 작동합니다. 그러나 우리는 고객이 AuthenticationProvider를 구현하는 자체 인증 클래스를 구현할 수있는 옵션을 제공하고자합니다. 그래서 그들은 애플 리케이션에서 우리의 항아리를 삭제하고 클래스 패스에 항아리를 추가합니다. 그것은 보안 XML에 나타납니다Spring 보안이 맞춤 인증 공급자를 구현하는 클래스의 구현을 선택하도록
우리는 AuthenticationProvider에 구현에만 클래스를 지정해야하지만 어쨌든 인터페이스의 AuthenticationProvider에게이
이<authentication-manager alias="authenticationManager">
<authentication-provider ref="customAuthenticationProvider"/>
</authentication-manager>
<beans:bean id="customAuthenticationProvider" class="w.x.y.z.CustomAuthenticationProvider"></beans:bean
@Component
public class CustomAuthenticationProvider implements AuthenticationProvider {
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
//Implementation
}
@Override
public boolean supports(Class<?> arg0) {
return true;
}
}
는 현재 XML 및 클래스 구현되어
구현하는 모든 클래스를 선택하는 봄 말할 수 없다 AuthenticationProvider를 구현하는 클래스를 선택하도록 Spring에게 알릴 수 있습니까?
이1은 IT가 클라이언트 및 삭제 된 항아리에 의해 추가 된 항아리 만 정의 유형에서 autowiring에 의해 주입 될 것이다 CustomAuthenticationProvider
이 (정확히해야합니다 :