0
私はSpringブートアプリケーションを持っています。それ以外の場合は、リソースへのアクセスを拒否する毎にAuthorization
ヘッダーを送信する必要があります。スプリングセキュリティdisable rememberMeが動作しない
しかし、私がこのヘッダを要求したなら、それなしでリクエストを送信し、リソースの内容を受け取ることができます。どうして?どこでコードが間違っていますか?
春のセキュリティ設定:
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.rememberMe().disable()
.csrf().disable()
.authorizeRequests().anyRequest().fullyAuthenticated().and()
.httpBasic().and()
.formLogin().disable()
.logout().disable();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("1").password("1").roles("USER");
}
}
コントローラー:
@RestController
public class FooController {
@RequestMapping("/foo")
public Bar bar() {
Bar bar = new Bar();
return bar;
}
}
おそらく、クライアントがセッションCookieを送信します。 [SessionCreationPolicyl#STATELESS](http://docs.spring.io/spring-security/site/docs/current/apidocs/org/springframework/security/config/http/SessionCreationPolicy.html#STATELESS)を使用して認証のためのHTTPセッション。 – dur