Reactive Spring Security is always creating the Session even when NoOpServerSecurityContextRepository specified for securityContextRepository
Tried below two methods and still Session object is being created in redis
Method-1
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public SecurityWebFilterChain configure(ServerHttpSecurity http) throws Exception {
http.authorizeExchange().pathMatchers("/api/path")
.authenticated()
.and()
.securityContextRepository(NoOpServerSecurityContextRepository.getInstance())
.oauth2ResourceServer().jwt();
return http.build();
}
Method-2
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public SecurityWebFilterChain configure(ServerHttpSecurity http) throws Exception {
http
.requestCache().disable()
.oauth2ResourceServer().jwt();
return http.build();
}
By trying both of the above given methods still every time redis Session object is creating when I invoke my API /api/path. Here is the github project where issue can be reproduced,
