私はこの問題のトピックがあることを知っていますが、私が作った設定は正しいです、そして、それは正しく動作するプロジェクトとそれを比較しました。 JWTセキュリティのために/ loginエンドポイントを「非セキュア」にしたいのですが、/ loginエンドポイントに到達する前にAuthenticationFilterが実行されています。 なぜ機能していないのか混乱しています。以下は春のセキュリティantMatchersのpermitAllは動作しません
マイコード:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests()
.antMatchers("/login").permitAll()
.anyRequest().authenticated();
http
.addFilterBefore(authenticationTokenFilterBean(), UsernamePasswordAuthenticationFilter.class);
http.headers().cacheControl();
}
[1つの特別なパスWebSecurityConfigurerAdapterにのみフィルタを追加する方法](https://stackoverflow.com/questions/45820372/how-to-add-a-filter-only-for-one-special- path-websecurityconfiguraradapter) – jfneis