Pick Up OidcSessionRegistry Bean
Closes gh-15813
This commit is contained in:
@@ -396,15 +396,13 @@ public class OidcLogoutConfigurerTests {
|
||||
@Import(RegistrationConfig.class)
|
||||
static class SelfLogoutUriConfig {
|
||||
|
||||
private final OidcSessionRegistry sessionRegistry = new InMemoryOidcSessionRegistry();
|
||||
|
||||
@Bean
|
||||
@Order(1)
|
||||
SecurityFilterChain filters(HttpSecurity http) throws Exception {
|
||||
// @formatter:off
|
||||
http
|
||||
.authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
|
||||
.oauth2Login((oauth2) -> oauth2.oidcSessionRegistry(this.sessionRegistry))
|
||||
.oauth2Login(Customizer.withDefaults())
|
||||
.oidcLogout((oidc) -> oidc
|
||||
.backChannel(Customizer.withDefaults())
|
||||
);
|
||||
@@ -413,11 +411,6 @@ public class OidcLogoutConfigurerTests {
|
||||
return http.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
OidcBackChannelLogoutHandler oidcLogoutHandler() {
|
||||
return new OidcBackChannelLogoutHandler(this.sessionRegistry);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -427,15 +420,13 @@ public class OidcLogoutConfigurerTests {
|
||||
|
||||
private final MockWebServer server = new MockWebServer();
|
||||
|
||||
private final OidcSessionRegistry sessionRegistry = new InMemoryOidcSessionRegistry();
|
||||
|
||||
@Bean
|
||||
@Order(1)
|
||||
SecurityFilterChain filters(HttpSecurity http) throws Exception {
|
||||
// @formatter:off
|
||||
http
|
||||
.authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
|
||||
.oauth2Login((oauth2) -> oauth2.oidcSessionRegistry(this.sessionRegistry))
|
||||
.oauth2Login(Customizer.withDefaults())
|
||||
.oidcLogout((oidc) -> oidc
|
||||
.backChannel(Customizer.withDefaults())
|
||||
);
|
||||
@@ -445,8 +436,13 @@ public class OidcLogoutConfigurerTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
OidcBackChannelLogoutHandler oidcLogoutHandler() {
|
||||
OidcBackChannelLogoutHandler logoutHandler = new OidcBackChannelLogoutHandler(this.sessionRegistry);
|
||||
OidcSessionRegistry sessionRegistry() {
|
||||
return new InMemoryOidcSessionRegistry();
|
||||
}
|
||||
|
||||
@Bean
|
||||
OidcBackChannelLogoutHandler oidcLogoutHandler(OidcSessionRegistry sessionRegistry) {
|
||||
OidcBackChannelLogoutHandler logoutHandler = new OidcBackChannelLogoutHandler(sessionRegistry);
|
||||
logoutHandler.setSessionCookieName("SESSION");
|
||||
return logoutHandler;
|
||||
}
|
||||
@@ -485,7 +481,7 @@ public class OidcLogoutConfigurerTests {
|
||||
// @formatter:off
|
||||
http
|
||||
.authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
|
||||
.oauth2Login((oauth2) -> oauth2.oidcSessionRegistry(this.sessionRegistry))
|
||||
.oauth2Login(Customizer.withDefaults())
|
||||
.oidcLogout((oidc) -> oidc.backChannel(Customizer.withDefaults()));
|
||||
// @formatter:on
|
||||
|
||||
|
||||
@@ -519,8 +519,6 @@ public class OidcLogoutSpecTests {
|
||||
@Import(RegistrationConfig.class)
|
||||
static class CookieConfig {
|
||||
|
||||
private final ReactiveOidcSessionRegistry sessionRegistry = new InMemoryReactiveOidcSessionRegistry();
|
||||
|
||||
private final MockWebServer server = new MockWebServer();
|
||||
|
||||
@Bean
|
||||
@@ -529,7 +527,7 @@ public class OidcLogoutSpecTests {
|
||||
// @formatter:off
|
||||
http
|
||||
.authorizeExchange((authorize) -> authorize.anyExchange().authenticated())
|
||||
.oauth2Login((oauth2) -> oauth2.oidcSessionRegistry(this.sessionRegistry))
|
||||
.oauth2Login(Customizer.withDefaults())
|
||||
.oidcLogout((oidc) -> oidc
|
||||
.backChannel(Customizer.withDefaults())
|
||||
);
|
||||
@@ -539,9 +537,13 @@ public class OidcLogoutSpecTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
OidcBackChannelServerLogoutHandler oidcLogoutHandler() {
|
||||
OidcBackChannelServerLogoutHandler logoutHandler = new OidcBackChannelServerLogoutHandler(
|
||||
this.sessionRegistry);
|
||||
ReactiveOidcSessionRegistry oidcSessionRegistry() {
|
||||
return new InMemoryReactiveOidcSessionRegistry();
|
||||
}
|
||||
|
||||
@Bean
|
||||
OidcBackChannelServerLogoutHandler oidcLogoutHandler(ReactiveOidcSessionRegistry sessionRegistry) {
|
||||
OidcBackChannelServerLogoutHandler logoutHandler = new OidcBackChannelServerLogoutHandler(sessionRegistry);
|
||||
logoutHandler.setSessionCookieName("JSESSIONID");
|
||||
return logoutHandler;
|
||||
}
|
||||
@@ -580,7 +582,7 @@ public class OidcLogoutSpecTests {
|
||||
// @formatter:off
|
||||
http
|
||||
.authorizeExchange((authorize) -> authorize.anyExchange().authenticated())
|
||||
.oauth2Login((oauth2) -> oauth2.oidcSessionRegistry(this.sessionRegistry))
|
||||
.oauth2Login(Customizer.withDefaults())
|
||||
.oidcLogout((oidc) -> oidc.backChannel(Customizer.withDefaults()));
|
||||
// @formatter:on
|
||||
|
||||
|
||||
Reference in New Issue
Block a user