diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.java index cf85e4a3575..99514c1b389 100644 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.java +++ b/documentation/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) { 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