Skip to content

[OID4VCI-FAPI2] Pass fapi2-security-profile-final-par-ensure-reused-request-uri-prior-to-auth-completion-succeeds#50126

Open
tdiesler wants to merge 1 commit into
keycloak:mainfrom
tdiesler:ghi48072
Open

[OID4VCI-FAPI2] Pass fapi2-security-profile-final-par-ensure-reused-request-uri-prior-to-auth-completion-succeeds#50126
tdiesler wants to merge 1 commit into
keycloak:mainfrom
tdiesler:ghi48072

Conversation

@tdiesler

Copy link
Copy Markdown
Contributor

closes #48072

…equest-uri-prior-to-auth-completion-succeeds

closes keycloak#48072

Signed-off-by: Thomas Diesler <tdiesler@proton.me>
Copilot AI review requested due to automatic review settings June 18, 2026 14:32
@tdiesler tdiesler requested a review from a team as a code owner June 18, 2026 14:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts Keycloak’s PAR (request_uri) handling to align with FAPI2 Security Profile guidance that one-time use of request_uri should be enforced at authorization completion (not merely on visiting the authorization endpoint), enabling conformance test fapi2-security-profile-final-par-ensure-reused-request-uri-prior-to-auth-completion-succeeds.

Changes:

  • Stop consuming/removing PAR request objects when first parsing request_uri at the authorization endpoint; defer removal until authentication/authorization completes.
  • Persist the request_uri in the authentication session so it can be consumed later.
  • Add a new Details.REQUEST_URI constant for reuse as an auth-note key.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
services/src/main/java/org/keycloak/protocol/oidc/par/endpoints/request/AuthzEndpointParParser.java Switches PAR request retrieval from “remove on read” to “get on read”; adjusts removal API.
services/src/main/java/org/keycloak/protocol/oidc/endpoints/AuthorizationEndpoint.java Stores request_uri as an auth note for later post-auth consumption.
services/src/main/java/org/keycloak/authentication/AuthenticationProcessor.java Removes PAR request object at authentication completion (authorization-time).
server-spi-private/src/main/java/org/keycloak/events/Details.java Adds REQUEST_URI constant.

Comment on lines +1253 to +1257
Response response = AuthenticationManager.finishedRequiredActions(session, authenticationSession, userSession, connection, request, uriInfo, event);

// Authorization servers that enforce one-time use of request_uri values do so at the point of authorization,
// not at the point of visiting the authorization endpoint
String requestUri = authenticationSession.getAuthNote(Details.REQUEST_URI);
Comment on lines +116 to 119
public static void removeRequestObject(KeycloakSession session, String requestUri) {
String key = getRequestObjectKey(requestUri);
return session.singleUseObjects().remove(CACHE_KEY_PREFIX + key);
session.singleUseObjects().remove(CACHE_KEY_PREFIX + key);
}
Comment on lines 401 to 406
this.event.event(EventType.LOGIN);
authenticationSession.setAuthNote(Details.AUTH_TYPE, CODE_AUTH_TYPE);
authenticationSession.setAuthNote(Details.REQUEST_URI, requestUriParam);

RequestUriType requestUriType = Optional.ofNullable(requestUriParam)
.map(AuthorizationEndpointRequestParserProcessor::getRequestUriType)
Comment on lines 1248 to +1250
if (nextRequiredAction != null) {
return AuthenticationManager.redirectToRequiredActions(session, realm, authenticationSession, uriInfo, nextRequiredAction);
Response response = AuthenticationManager.redirectToRequiredActions(session, realm, authenticationSession, uriInfo, nextRequiredAction);
return response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OID4VCI-FAPI2] Pass fapi2-security-profile-final-par-ensure-reused-request-uri-prior-to-auth-completion-succeeds

2 participants