Skip to content

Commit af6fce4

Browse files
jzheauxSteve Riesenberg
authored and
Steve Riesenberg
committed
Fix Documentation Errors
Issue gh-12570 (cherry picked from commit 6b0d822)
1 parent a222318 commit af6fce4

File tree

3 files changed

+2
-111
lines changed

3 files changed

+2
-111
lines changed

docs/modules/ROOT/pages/reactive/oauth2/login/logout.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ open fun filterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
173173

174174
And that's it!
175175

176-
This will stand up the endpoint `/logout/connect/back-channel/+{registrationId}` which the OIDC Provider can request to invalidate a given session of an end user in your application.
176+
This will stand up the endpoint `+/logout/connect/back-channel/{registrationId}+` which the OIDC Provider can request to invalidate a given session of an end user in your application.
177177

178178
[NOTE]
179179
`oidcLogout` requires that `oauth2Login` also be configured.

docs/modules/ROOT/pages/servlet/oauth2/login/advanced.adoc

-109
Original file line numberDiff line numberDiff line change
@@ -929,114 +929,5 @@ For MAC-based algorithms (such as `HS256`, `HS384`, or `HS512`), the `client-sec
929929
If more than one `ClientRegistration` is configured for OpenID Connect 1.0 Authentication, the JWS algorithm resolver may evaluate the provided `ClientRegistration` to determine which algorithm to return.
930930
====
931931

932-
933-
[[oauth2login-advanced-oidc-logout]]
934-
== OpenID Connect 1.0 Logout
935-
936-
OpenID Connect Session Management 1.0 allows the ability to log out the end user at the Provider by using the Client.
937-
One of the strategies available is https://openid.net/specs/openid-connect-rpinitiated-1_0.html[RP-Initiated Logout].
938-
939-
If the OpenID Provider supports both Session Management and https://openid.net/specs/openid-connect-discovery-1_0.html[Discovery], the client can obtain the `end_session_endpoint` `URL` from the OpenID Provider's https://openid.net/specs/openid-connect-session-1_0.html#OPMetadata[Discovery Metadata].
940-
You can do so by configuring the `ClientRegistration` with the `issuer-uri`, as follows:
941-
942-
[source,yaml]
943-
----
944-
spring:
945-
security:
946-
oauth2:
947-
client:
948-
registration:
949-
okta:
950-
client-id: okta-client-id
951-
client-secret: okta-client-secret
952-
...
953-
provider:
954-
okta:
955-
issuer-uri: https://dev-1234.oktapreview.com
956-
----
957-
958-
Also, you can configure `OidcClientInitiatedLogoutSuccessHandler`, which implements RP-Initiated Logout, as follows:
959-
960-
[tabs]
961-
======
962-
Java::
963-
+
964-
[source,java,role="primary"]
965-
----
966-
@Configuration
967-
@EnableWebSecurity
968-
public class OAuth2LoginSecurityConfig {
969-
970-
@Autowired
971-
private ClientRegistrationRepository clientRegistrationRepository;
972-
973-
@Bean
974-
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
975-
http
976-
.authorizeHttpRequests(authorize -> authorize
977-
.anyRequest().authenticated()
978-
)
979-
.oauth2Login(withDefaults())
980-
.logout(logout -> logout
981-
.logoutSuccessHandler(oidcLogoutSuccessHandler())
982-
);
983-
return http.build();
984-
}
985-
986-
private LogoutSuccessHandler oidcLogoutSuccessHandler() {
987-
OidcClientInitiatedLogoutSuccessHandler oidcLogoutSuccessHandler =
988-
new OidcClientInitiatedLogoutSuccessHandler(this.clientRegistrationRepository);
989-
990-
// Sets the location that the End-User's User Agent will be redirected to
991-
// after the logout has been performed at the Provider
992-
oidcLogoutSuccessHandler.setPostLogoutRedirectUri("{baseUrl}");
993-
994-
return oidcLogoutSuccessHandler;
995-
}
996-
}
997-
----
998-
999-
Kotlin::
1000-
+
1001-
[source,kotlin,role="secondary"]
1002-
----
1003-
@Configuration
1004-
@EnableWebSecurity
1005-
class OAuth2LoginSecurityConfig {
1006-
@Autowired
1007-
private lateinit var clientRegistrationRepository: ClientRegistrationRepository
1008-
1009-
@Bean
1010-
open fun filterChain(http: HttpSecurity): SecurityFilterChain {
1011-
http {
1012-
authorizeRequests {
1013-
authorize(anyRequest, authenticated)
1014-
}
1015-
oauth2Login { }
1016-
logout {
1017-
logoutSuccessHandler = oidcLogoutSuccessHandler()
1018-
}
1019-
}
1020-
return http.build()
1021-
}
1022-
1023-
private fun oidcLogoutSuccessHandler(): LogoutSuccessHandler {
1024-
val oidcLogoutSuccessHandler = OidcClientInitiatedLogoutSuccessHandler(clientRegistrationRepository)
1025-
1026-
// Sets the location that the End-User's User Agent will be redirected to
1027-
// after the logout has been performed at the Provider
1028-
oidcLogoutSuccessHandler.setPostLogoutRedirectUri("{baseUrl}")
1029-
return oidcLogoutSuccessHandler
1030-
}
1031-
}
1032-
----
1033-
======
1034-
1035-
[NOTE]
1036-
====
1037-
`OidcClientInitiatedLogoutSuccessHandler` supports the `+{baseUrl}+` placeholder.
1038-
If used, the application's base URL, such as `https://app.example.org`, replaces it at request time.
1039-
====
1040-
1041932
[[oauth2login-advanced-oidc-logout]]
1042933
Then, you can proceed to configure xref:reactive/oauth2/login/logout.adoc[logout]

docs/modules/ROOT/pages/servlet/oauth2/login/logout.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ open fun filterChain(http: HttpSecurity): SecurityFilterChain {
172172

173173
And that's it!
174174

175-
This will stand up the endpoint `/logout/connect/back-channel/+{registrationId}` which the OIDC Provider can request to invalidate a given session of an end user in your application.
175+
This will stand up the endpoint `+/logout/connect/back-channel/{registrationId}+` which the OIDC Provider can request to invalidate a given session of an end user in your application.
176176

177177
[NOTE]
178178
`oidcLogout` requires that `oauth2Login` also be configured.

0 commit comments

Comments
 (0)