"해킹"으로 작동하는 SPNEGO와 함께 스프링 보안 구성이 있습니다. 다음과 같습니다 :WebSecurityConfigurerAdapter with custom authentication 필터 - 종속성 문제
- 내가 spnegoAuthenticationProcessingFilter (1)
- 는이 필터의 AuthenticationManager에 의존성이 (2)
- 내가 인증을 추가해야 추가해야합니다 : 무슨 일이 일어나고 무엇
@Configuration @EnableWebSecurity public class SpnegoConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http ... .addFilterBefore( spnegoAuthenticationProcessingFilter(authenticationManagerBean()), BasicAuthenticationFilter.class); // 1 } @Override @Autowired // 3 protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth .authenticationProvider(kerberosAuthenticationProvider()) .authenticationProvider(kerberosServiceAuthenticationProvider()); } @Bean public SpnegoAuthenticationProcessingFilter spnegoAuthenticationProcessingFilter( AuthenticationManager authenticationManager) { // 2 SpnegoAuthenticationProcessingFilter filter = new SpnegoAuthenticationProcessingFilter(); filter.setAuthenticationManager(authenticationManager); return filter; } ... }
제공 업체 (3)
포인트가있는 클래스는 WebSecurityConfigurerAdapter
입니다. 이 방법 rriding :
configure(HttpSecurity http)
-이 이미 사용자 정의 필터를 통해AuthenticationManager
내장에 의존성이를configure(AuthenticationManagerBuilder auth)
-이 명확하게AuthenticationManager
에 관련되지 아니 아직 건설되고 - 우리는
경우를 구축하고 나는 방법 (3)에 @Autowired
을 가지고 있지 않다. AuthenticationManager
은 너무 일찍 만들어졌고 나의 추가는 AuthenticationProvider
이다. 아무런 효과가 없다. 적절한 AuthenticationProvider
이 없으면 인증이 실패합니다.
@Autowired
이 제대로 작동하면 작동하지만 잘못된 것입니다. 나는 그것이 왜 일하기 시작하는지조차 확신하지 못한다.
올바른 방법에 대한 조언을 구하십시오.
편집 : 실제로는 @Autowired없이 작동합니다. 그러나 요점은 인정 된 대답에있다. AuthenticationManager
을 @Configuration
에 의존하는 경우 노출되었거나 authenticationManagerBean()
방법을 통해 참조되어 있는지 확인하십시오.