From f184d130968d6532464cdd63fc5b6bc4e6305165 Mon Sep 17 00:00:00 2001 From: Antoine Rey Date: Thu, 4 Jul 2024 08:17:46 +0200 Subject: [PATCH] Update the OAuth2 jwt and opaque resource server documentation with the Lambda DSL The OAuth2ResourceServerConfigurer::opaqueToken() and ::jwt() methods are deprecated since Spring Security 6.1 --- .../ROOT/pages/servlet/oauth2/resource-server/jwt.adoc | 4 +++- .../servlet/oauth2/resource-server/opaque-token.adoc | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/modules/ROOT/pages/servlet/oauth2/resource-server/jwt.adoc b/docs/modules/ROOT/pages/servlet/oauth2/resource-server/jwt.adoc index 87dc8458ec..4296127a35 100644 --- a/docs/modules/ROOT/pages/servlet/oauth2/resource-server/jwt.adoc +++ b/docs/modules/ROOT/pages/servlet/oauth2/resource-server/jwt.adoc @@ -879,7 +879,9 @@ public class DirectlyConfiguredJwkSetUri { .requestMatchers("/messages/**").access(hasScope("messages")) .anyRequest().authenticated() ) - .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt); + .oauth2ResourceServer(oauth2 -> oauth2 + .jwt(Customizer.withDefaults()) + ); return http.build(); } } diff --git a/docs/modules/ROOT/pages/servlet/oauth2/resource-server/opaque-token.adoc b/docs/modules/ROOT/pages/servlet/oauth2/resource-server/opaque-token.adoc index fcd3b4f2c4..551ac360fd 100644 --- a/docs/modules/ROOT/pages/servlet/oauth2/resource-server/opaque-token.adoc +++ b/docs/modules/ROOT/pages/servlet/oauth2/resource-server/opaque-token.adoc @@ -204,7 +204,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .authorizeHttpRequests(authorize -> authorize .anyRequest().authenticated() ) - .oauth2ResourceServer(OAuth2ResourceServerConfigurer::opaqueToken); + .oauth2ResourceServer(oauth2 -> oauth2 + .opaqueToken(Customizer.withDefaults()) + ); return http.build(); } ---- @@ -564,7 +566,9 @@ public class MappedAuthorities { .requestMatchers("/messages/**").access(hasScope("messages")) .anyRequest().authenticated() ) - .oauth2ResourceServer(OAuth2ResourceServerConfigurer::opaqueToken); + .oauth2ResourceServer(oauth2 -> oauth2 + .opaqueToken(Customizer.withDefaults()) + ); return http.build(); } }