Skip to content

Commit

Permalink
Encode URL in OIDC cookie
Browse files Browse the repository at this point in the history
Fix #31802
  • Loading branch information
gsmet committed Aug 21, 2024
1 parent c75c0f4 commit 6f27735
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import static io.quarkus.oidc.runtime.OidcIdentityProvider.REFRESH_TOKEN_GRANT_RESPONSE;

import java.net.URI;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.SecureRandom;
Expand Down Expand Up @@ -940,7 +942,7 @@ private CodeAuthenticationStateBean getCodeAuthenticationBean(String[] parsedSta
Authentication authentication = configContext.oidcConfig.authentication;
boolean pkceRequired = authentication.pkceRequired.orElse(false);
if (!pkceRequired && !authentication.nonceRequired) {
bean.setRestorePath(parsedStateCookieValue[1]);
bean.setRestorePath(URLDecoder.decode(parsedStateCookieValue[1], StandardCharsets.UTF_8));
return bean;
}

Expand Down Expand Up @@ -1177,7 +1179,7 @@ private String encodeExtraStateValue(CodeAuthenticationStateBean extraStateValue
throw new AuthenticationCompletionException(ex);
}
} else {
return extraStateValue.getRestorePath();
return URLEncoder.encode(extraStateValue.getRestorePath(), StandardCharsets.UTF_8);
}

}
Expand Down

0 comments on commit 6f27735

Please sign in to comment.