0
스프링 부트 1.1.7을 사용하여 안정적인 리소스를 확보하는 데 문제가 있습니다. 사용자 지정 AuthenticationProvider를 사용하여 SecurityConfiguration을 만들었습니다.스프링 부트 편안한 리소스 보안 - 인증이 실행되지 않음
SecurityConfiguration 및 AuthenticationProvider Bean이로드되고 있지만 사용자 정의 '인증'메소드가 절대로 실행되지 않습니다. 대부분의 자습서를 검토했지만 맞춤 인증을 사용하여 모든 URL에 대한 액세스를 제한 할 수는 없습니다.
@EnableWebSecurity
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
final static Logger log = LoggerFactory.getLogger(SecurityConfiguration.class);
private @Autowired CustomAuthenticationProvider provider;
/**
* Configure global.
*
* @param auth the auth
* @throws Exception the exception
*/
// @Autowired
// public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// auth.authenticationProvider(this.provider);
// }
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
log.warn("Configure AuthMgrBuilder");
auth.authenticationProvider(this.provider);
}
/* (non-Javadoc)
* @see org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter#configure(org.springframework.security.config.annotation.web.builders.HttpSecurity)
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
log.warn("Configure http");
http.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.csrf().disable();
}
}
저에게는 완벽하게 의미가있는 것처럼 보입니다. 다른 방법으로 자격 정보를 수집하려면 그 정보가 무엇인지 말할 필요가 있습니다 (Spring은 추측 할 수 없을 것입니다). –