Skip to content

Commit

Permalink
Fix doubled client basePath by SpringAddonsServerOAuth2AuthorizationR…
Browse files Browse the repository at this point in the history
…equestResolver
  • Loading branch information
ch4mpy committed Jan 30, 2024
1 parent 02fded0 commit 2cfd248
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -45,6 +46,7 @@
* @see SpringAddonsOauth2ServerAuthenticationSuccessHandler
* @see SpringAddonsOauth2ServerAuthenticationFailureHandler
*/
@Slf4j
public class SpringAddonsServerOAuth2AuthorizationRequestResolver extends DefaultServerOAuth2AuthorizationRequestResolver {

private static final Pattern authorizationRequestPattern = Pattern.compile("\\/oauth2\\/authorization\\/([^\\/]+)");
Expand Down Expand Up @@ -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<OAuth2AuthorizationRequest> resolve(ServerWebExchange exchange) {
setAuthorizationRequestCustomizer(authRequestCustomizer(exchange));
return savePostLoginUrisInSession(exchange).then(super.resolve(exchange).map(this::postProcess));
}

@Override
public Mono<OAuth2AuthorizationRequest> resolve(ServerWebExchange exchange, String clientRegistrationId) {
setAuthorizationRequestCustomizer(authRequestCustomizer(clientRegistrationId));
Expand Down

0 comments on commit 2cfd248

Please sign in to comment.