From f8a78f1864d6c270a58aaf83f92286f99faac56e Mon Sep 17 00:00:00 2001 From: Steve Riesenberg <5248162+sjohnr@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:59:07 -0500 Subject: [PATCH] Update What's New --- docs/modules/ROOT/pages/whats-new.adoc | 78 ++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/docs/modules/ROOT/pages/whats-new.adoc b/docs/modules/ROOT/pages/whats-new.adoc index 6e1cb5ca66..48a804e7dc 100644 --- a/docs/modules/ROOT/pages/whats-new.adoc +++ b/docs/modules/ROOT/pages/whats-new.adoc @@ -52,8 +52,86 @@ This aids in migration from earlier versions of Spring Security. == OAuth 2.0 * `oauth2Login()` now accepts https://github.com/spring-projects/spring-security/pull/15237[`OAuth2AuthorizationRequestResolver` as a `@Bean`] +* Added `loginPage()` to DSL in reactive `oauth2Login()` * OIDC Back-Channel support now accepts https://github.com/spring-projects/spring-security/issues/15003[logout tokens of type `logout+jwt`] * `RestClient` can now be xref:servlet/oauth2/index.adoc#oauth2-client-access-protected-resources[configured] with `OAuth2ClientHttpRequestInterceptor` to xref:servlet/oauth2/index.adoc#oauth2-client-accessing-protected-resources-example[make protected resources requests] +* Added `RestClient`-based implementations of `OAuth2AccessTokenResponseClient` for more consistent configuration of access token requests. ++ +To opt-in to using `RestClient` support, simply publish a bean for each grant type as in the following example: ++ +[tabs] +====== +Java:: ++ +[source,java,role="primary"] +---- +@Configuration +public class SecurityConfig { + + @Bean + public OAuth2AccessTokenResponseClient authorizationCodeAccessTokenResponseClient() { + return new RestClientAuthorizationCodeTokenResponseClient(); + } + + @Bean + public OAuth2AccessTokenResponseClient refreshTokenAccessTokenResponseClient() { + return new RestClientRefreshTokenTokenResponseClient(); + } + + @Bean + public OAuth2AccessTokenResponseClient clientCredentialsAccessTokenResponseClient() { + return new RestClientClientCredentialsTokenResponseClient(); + } + + @Bean + public OAuth2AccessTokenResponseClient jwtBearerAccessTokenResponseClient() { + return new RestClientJwtBearerTokenResponseClient(); + } + + @Bean + public OAuth2AccessTokenResponseClient tokenExchangeAccessTokenResponseClient() { + return new RestClientTokenExchangeTokenResponseClient(); + } + +} +---- + +Kotlin:: ++ +[source,kotlin,role="secondary"] +---- +@Configuration +class SecurityConfig { + + @Bean + fun authorizationCodeAccessTokenResponseClient(): OAuth2AccessTokenResponseClient { + return RestClientAuthorizationCodeTokenResponseClient() + } + + @Bean + fun refreshTokenAccessTokenResponseClient(): OAuth2AccessTokenResponseClient { + return RestClientRefreshTokenTokenResponseClient() + } + + @Bean + fun clientCredentialsAccessTokenResponseClient(): OAuth2AccessTokenResponseClient { + return RestClientClientCredentialsTokenResponseClient() + } + + @Bean + fun jwtBearerAccessTokenResponseClient(): OAuth2AccessTokenResponseClient { + return RestClientJwtBearerTokenResponseClient() + } + + @Bean + fun tokenExchangeAccessTokenResponseClient(): OAuth2AccessTokenResponseClient { + return RestClientTokenExchangeTokenResponseClient() + } + +} +---- +====== +* Deprecated `Default*` implementations of `OAuth2AccessTokenResponseClient` == SAML 2.0