From 2cfd248d60087c64302d8891b45f59e163969dd6 Mon Sep 17 00:00:00 2001 From: ch4mpy Date: Tue, 30 Jan 2024 13:25:04 -1000 Subject: [PATCH] Fix doubled client basePath by SpringAddonsServerOAuth2AuthorizationRequestResolver --- ...ngAddonsServerOAuth2AuthorizationRequestResolver.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/spring-addons-starter-oidc/src/main/java/com/c4_soft/springaddons/security/oidc/starter/reactive/client/SpringAddonsServerOAuth2AuthorizationRequestResolver.java b/spring-addons-starter-oidc/src/main/java/com/c4_soft/springaddons/security/oidc/starter/reactive/client/SpringAddonsServerOAuth2AuthorizationRequestResolver.java index 95342019a..ba4062fd8 100644 --- a/spring-addons-starter-oidc/src/main/java/com/c4_soft/springaddons/security/oidc/starter/reactive/client/SpringAddonsServerOAuth2AuthorizationRequestResolver.java +++ b/spring-addons-starter-oidc/src/main/java/com/c4_soft/springaddons/security/oidc/starter/reactive/client/SpringAddonsServerOAuth2AuthorizationRequestResolver.java @@ -22,6 +22,7 @@ import com.c4_soft.springaddons.security.oidc.starter.properties.SpringAddonsOidcClientProperties; import com.c4_soft.springaddons.security.oidc.starter.properties.SpringAddonsOidcClientProperties.RequestParam; +import lombok.extern.slf4j.Slf4j; import reactor.core.publisher.Mono; /** @@ -45,6 +46,7 @@ * @see SpringAddonsOauth2ServerAuthenticationSuccessHandler * @see SpringAddonsOauth2ServerAuthenticationFailureHandler */ +@Slf4j public class SpringAddonsServerOAuth2AuthorizationRequestResolver extends DefaultServerOAuth2AuthorizationRequestResolver { private static final Pattern authorizationRequestPattern = Pattern.compile("\\/oauth2\\/authorization\\/([^\\/]+)"); @@ -96,15 +98,10 @@ private OAuth2AuthorizationRequest postProcess(OAuth2AuthorizationRequest reques UriComponentsBuilder.fromUri(clientUri).path(original.getPath()).query(original.getQuery()).fragment(original.getFragment()).build().toString(); modified.redirectUri(redirectUri); + log.debug("Changed OAuth2AuthorizationRequest redirectUri from {} to {}", original, redirectUri); return modified.build(); } - @Override - public Mono resolve(ServerWebExchange exchange) { - setAuthorizationRequestCustomizer(authRequestCustomizer(exchange)); - return savePostLoginUrisInSession(exchange).then(super.resolve(exchange).map(this::postProcess)); - } - @Override public Mono resolve(ServerWebExchange exchange, String clientRegistrationId) { setAuthorizationRequestCustomizer(authRequestCustomizer(clientRegistrationId));