From 82dd06a80dd1a60f88baf12d21b961b279049796 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 10 Apr 2026 16:59:17 -0700 Subject: [PATCH] Add missing MySamlRelyingPartyConfiguration Kotlin sample Closes gh-50023 --- .../MySamlRelyingPartyConfiguration.java | 6 ++-- .../MySamlRelyingPartyConfiguration.kt | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.kt diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.java index 770e435ed8e..0739580240d 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.java @@ -30,8 +30,10 @@ public class MySamlRelyingPartyConfiguration { public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated()); http.saml2Login(withDefaults()); - http.saml2Logout((saml2) -> saml2.logoutRequest((request) -> request.logoutUrl("/SLOService.saml2")) - .logoutResponse((response) -> response.logoutUrl("/SLOService.saml2"))); + http.saml2Logout((saml2) -> { + saml2.logoutRequest((request) -> request.logoutUrl("/SLOService.saml2")); + saml2.logoutResponse((response) -> response.logoutUrl("/SLOService.saml2")); + }); return http.build(); } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.kt new file mode 100644 index 00000000000..f5b9845a43b --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.kt @@ -0,0 +1,28 @@ +package org.springframework.boot.docs.web.security.saml2.relyingparty + +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.security.config.annotation.web.builders.HttpSecurity +import org.springframework.security.config.annotation.web.invoke +import org.springframework.security.web.SecurityFilterChain + + +@Configuration(proxyBeanMethods = false) +open class MySamlRelyingPartyConfiguration { + + @Bean + open fun securityFilterChain(http: HttpSecurity): SecurityFilterChain { + http { + authorizeHttpRequests { + authorize(anyRequest, authenticated) + } + saml2Login { } + saml2Logout { + logoutRequest { logoutUrl = "/SLOService.saml2" } + logoutResponse { logoutUrl = "/SLOService.saml2" } + } + } + return http.build() + } + +} \ No newline at end of file