.AND()requiresChannelを()リダイレクトする必要がありanyRequest()requiresSecure()春のMVC:。。。セキュリティ設定requireSecure()恒久的に301
私は上記の構成でHTTPSを強制していますが、問題は一時的にリダイレクトユーザーです(302)。私はここで
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private MyAuthenticationProvider _auth;
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(_auth);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.headers().disable().authorizeRequests()
.someCodehere.
.and().requiresChannel().antMatchers("/ping").requiresInsecure()
.and().requiresChannel().anyRequest().requiresSecure()
.and().csrf().disable();
}
}
これに必要なmavenの依存関係はありますか? 'org.springframework.beans.factory.BeanCreationException:名前が 'org.spri[email protected]41921212'のBeanを作成中にエラーが発生しました:initメソッドの呼び出しに失敗しました。ネストされた例外はjava.lang.IllegalArgumentExceptionです:サポートされていない設定属性:[REQUIRES_INSECURE_CHANNEL] ' –
質問に完全なスタックトレースを追加してください –
' InsecureChannelProcessor'を 'requiresSecure()'に偶然追加しませんか? –