Package org.keycloak.broker.oid4vp
Class OID4VPIdentityProviderEndpoint
java.lang.Object
org.keycloak.broker.oid4vp.OID4VPIdentityProviderEndpoint
JAX-RS endpoint backing the OID4VP wallet flow, routed at
/realms/{realm}/broker/{alias}/endpoint.
GET /request-object/{handle}serves the signed authorization request object.POST /receives the wallet'sdirect_postpresentation, verifies it, and returns the browser redirect that finalizes login, or an empty JSON object for the cross device flow where the remote wallet cannot drive the browser.GET /statustells the polling login page whether the cross device presentation arrived.GET /complete-authresolves the deferred identity and hands control back to Keycloak.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOID4VPIdentityProviderEndpoint(KeycloakSession session, RealmModel realm, OID4VPIdentityProvider provider, UserAuthenticationIdentityProvider.AuthenticationCallback callback, EventBuilder event) -
Method Summary
Modifier and TypeMethodDescriptionprotected RequestObjectbuildRequestObject(String state, RequestContext requestContext, boolean crossDevice) jakarta.ws.rs.core.ResponsecompleteAuth(String state, String responseCode) protected StringcompleteAuthUrl(String state, String responseCode) protected DcqlQueryprotected DecryptedResponsedecryptResponse(String response) jakarta.ws.rs.core.ResponsedirectPost(String vpToken, String state, String response, String flow) static jakarta.ws.rs.core.UriBuilderendpointBaseUri(jakarta.ws.rs.core.UriBuilder baseUriBuilder, String realmName, String alias) protected static jakarta.ws.rs.core.ResponseerrorResponse(jakarta.ws.rs.core.Response.Status status, String error, String description) protected static booleanisCrossDevice(String flow) protected jakarta.ws.rs.core.ResponseloginError(jakarta.ws.rs.core.Response.Status status, String error, String description, String eventError) protected jakarta.ws.rs.core.ResponseloginErrorPage(AuthenticationSessionModel authSession, String messageKey) jakarta.ws.rs.core.ResponserequestObject(String state, String flow) protected StringrequirePrincipalClaim(RequestedCredentials.Principal principal, com.fasterxml.jackson.databind.JsonNode claims) protected AuthenticationSessionModelresolveAuthSession(String rootSessionId, String tabId) protected StringresponseUri(boolean crossDevice) jakarta.ws.rs.core.Responseprotected static jakarta.ws.rs.core.ResponsestatusResponse(jakarta.ws.rs.core.Response.Status httpStatus, String status, String redirectUri) protected BrokeredIdentityContexttoBrokeredContext(com.fasterxml.jackson.databind.JsonNode claims, AuthenticationSessionModel authSession) protected SdJwtVpVerificationResultverifyPresentation(RequestedCredentials.Credential credential, String presentation, String nonce) protected com.fasterxml.jackson.databind.node.ObjectNodeverifyPresentations(String vpToken, String nonce) Verifies the presentation of each presented credential and requires the presented credentials to satisfy the required credential sets.
-
Field Details
-
REQUEST_OBJECT_PATH
- See Also:
-
COMPLETE_AUTH_PATH
- See Also:
-
STATUS_PATH
- See Also:
-
FLOW_PARAM
- See Also:
-
FLOW_CROSS_DEVICE
- See Also:
-
STATUS_KEY
- See Also:
-
STATUS_REDIRECT_URI_KEY
- See Also:
-
STATUS_PENDING
- See Also:
-
STATUS_COMPLETE
- See Also:
-
STATUS_EXPIRED
- See Also:
-
STATUS_ERROR
- See Also:
-
-
Constructor Details
-
OID4VPIdentityProviderEndpoint
public OID4VPIdentityProviderEndpoint(KeycloakSession session, RealmModel realm, OID4VPIdentityProvider provider, UserAuthenticationIdentityProvider.AuthenticationCallback callback, EventBuilder event)
-
-
Method Details
-
requestObject
-
directPost
-
status
@GET @Path("/status") @Produces("application/json") public jakarta.ws.rs.core.Response status(@QueryParam("state") String state) -
completeAuth
-
buildRequestObject
protected RequestObject buildRequestObject(String state, RequestContext requestContext, boolean crossDevice) -
dcqlQuery
-
decryptResponse
- Throws:
VerificationException
-
verifyPresentations
protected com.fasterxml.jackson.databind.node.ObjectNode verifyPresentations(String vpToken, String nonce) throws VerificationException Verifies the presentation of each presented credential and requires the presented credentials to satisfy the required credential sets.- Returns:
- the disclosed claims of the presented credentials by credential id
- Throws:
VerificationException
-
verifyPresentation
protected SdJwtVpVerificationResult verifyPresentation(RequestedCredentials.Credential credential, String presentation, String nonce) throws VerificationException - Throws:
VerificationException
-
requirePrincipalClaim
protected String requirePrincipalClaim(RequestedCredentials.Principal principal, com.fasterxml.jackson.databind.JsonNode claims) -
toBrokeredContext
protected BrokeredIdentityContext toBrokeredContext(com.fasterxml.jackson.databind.JsonNode claims, AuthenticationSessionModel authSession) -
resolveAuthSession
-
endpointBaseUri
-
responseUri
-
isCrossDevice
-
statusResponse
-
completeAuthUrl
-
loginError
-
loginErrorPage
protected jakarta.ws.rs.core.Response loginErrorPage(AuthenticationSessionModel authSession, String messageKey) -
errorResponse
-