Class OID4VCIssuerEndpoint
java.lang.Object
org.keycloak.protocol.oid4vc.issuance.OID4VCIssuerEndpoint
Provides the (REST-)endpoints required for the OID4VCI protocol.
- Author:
- Stefan Wiedemann
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOID4VCIssuerEndpoint(KeycloakSession keycloakSession) OID4VCIssuerEndpoint(KeycloakSession session, Map<String, CredentialBuilder> credentialBuilders, AppAuthManager.BearerTokenAuthenticator authenticator, TimeProvider timeProvider, int preAuthorizedCodeLifeSpan) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsecreateCredentialOffer(String credConfigId) Creates a Pre-Authorized offer that is bound to the calling user.jakarta.ws.rs.core.ResponsecreateCredentialOffer(String credConfigId, boolean preAuthorized, String targetUser) Creates a Credential Offer that is bound to a specific user.jakarta.ws.rs.core.ResponsecreateCredentialOffer(String credConfigId, Boolean preAuthorized, Boolean withTxCode, String targetUser, Integer expireAt, OfferResponseType responseType, int width, int height) Creates a Credential Offer that can be pre-authorized and/or bound to a specific target user.jakarta.ws.rs.core.ResponseHandles CORS preflight requests for the /create-credential-offer endpoint.jakarta.ws.rs.core.Responsethe OpenId4VCI nonce-endpointjakarta.ws.rs.core.ResponsegetCredentialOffer(String nonce) Provides an OID4VCI compliant credential offerjakarta.ws.rs.core.ResponseHandles CORS preflight requests for credential offer endpointjakarta.ws.rs.core.ResponserequestCredential(String requestPayload) Returns a verifiable credential
-
Field Details
-
DEFLATE_COMPRESSION
- See Also:
-
NONCE_PATH
- See Also:
-
CREDENTIAL_PATH
- See Also:
-
CREDENTIAL_OFFER_PATH
- See Also:
-
CREATE_CREDENTIAL_OFFER_PATH
- See Also:
-
RESPONSE_TYPE_IMG_PNG
- See Also:
-
CREDENTIAL_OFFER_URI_CODE_SCOPE
- See Also:
-
-
Constructor Details
-
OID4VCIssuerEndpoint
public OID4VCIssuerEndpoint(KeycloakSession session, Map<String, CredentialBuilder> credentialBuilders, AppAuthManager.BearerTokenAuthenticator authenticator, TimeProvider timeProvider, int preAuthorizedCodeLifeSpan) -
OID4VCIssuerEndpoint
-
-
Method Details
-
getCNonce
@POST @Produces("application/json") @Path("nonce") public jakarta.ws.rs.core.Response getCNonce()the OpenId4VCI nonce-endpoint- Returns:
- a short-lived c_nonce value that must be presented in key-bound proofs at the credential endpoint.
- See Also:
-
createCredentialOfferPreflight
@OPTIONS @Path("create-credential-offer") public jakarta.ws.rs.core.Response createCredentialOfferPreflight()Handles CORS preflight requests for the /create-credential-offer endpoint. Preflight requests return CORS headers for all origins (standard CORS behavior). The actual request will validate origins against client configuration. -
createCredentialOffer
Creates a Pre-Authorized offer that is bound to the calling user. -
createCredentialOffer
public jakarta.ws.rs.core.Response createCredentialOffer(String credConfigId, boolean preAuthorized, String targetUser) Creates a Credential Offer that is bound to a specific user. -
createCredentialOffer
@GET @Produces({"application/json","image/png"}) @Path("create-credential-offer") public jakarta.ws.rs.core.Response createCredentialOffer(@QueryParam("credential_configuration_id") String credConfigId, @QueryParam("pre_authorized") @DefaultValue("true") Boolean preAuthorized, @QueryParam("tx_code") @DefaultValue("false") Boolean withTxCode, @QueryParam("target_user") String targetUser, @QueryParam("expire") Integer expireAt, @QueryParam("type") @DefaultValue("uri") OfferResponseType responseType, @QueryParam("width") @DefaultValue("200") int width, @QueryParam("height") @DefaultValue("200") int height) Creates a Credential Offer that can be pre-authorized and/or bound to a specific target user.Credential Offer Validity Matrix for the supported request parameters "pre_authorized", "targetUser" combinations.
+----------+----------+---------+--------------------------------------------+ | Pre-Auth | Username | Valid | Notes | +----------+----------+---------+--------------------------------------------+ | no | no | yes | Anonymous offer; works for any login user. | | no | yes | yes | Offer restricted to a specific user. | +----------+----------+---------+--------------------------------------------+ | yes | no | yes | Self issued pre-auth offer. | | yes | yes | yes | Offer restricted to a specific user. | +----------+----------+---------+--------------------------------------------+ Pre-Authorized Offer- A pre-authorized offer is authorized for the clientId from the current login session
- If targetUser is null or empty, it defaults to the user from the current login session
- If targetUser is equal to the current login, the generated offer is "self issued"
- To create an offer for another user, the issuing user must hold the
credential_offer_createrole - A pre-authorized offer can optionally have an associated tx_code
- An offer can optionally have a predefined expiry date
- If targetUser is null or empty, the generated offer is "anonymous"
- If targetUser is equal to the current login, the offer is "self issued"
- If targetUser is none of the above, the offer is "targeted"
- For a targeted offer, the issuing user must hold the
credential_offer_createrole - An offer can optionally have a predefined expiry date
- Parameters:
credConfigId- A valid credential configuration idpreAuthorized- A flag whether the offer should be pre-authorizedtargetUser- The username that the offer is authorized forwithTxCode- A flag whether a tx_code should be generated for a pre-auth offerexpireAt- The date/time when the offer expires (in Unix timestamp seconds)responseType- The response type, which can be 'uri', 'qr' or 'uri+qr'width- The width of the QR code imageheight- The height of the QR code image
-
getCredentialOfferPreflight
@OPTIONS @Path("credential-offer/{nonce}") public jakarta.ws.rs.core.Response getCredentialOfferPreflight(@PathParam("nonce") String nonce) Handles CORS preflight requests for credential offer endpoint -
getCredentialOffer
@GET @Produces("application/json") @Path("credential-offer/{nonce}") public jakarta.ws.rs.core.Response getCredentialOffer(@PathParam("nonce") String nonce) Provides an OID4VCI compliant credential offer -
requestCredential
@POST @Consumes({"application/json","application/jwt"}) @Produces({"application/json","application/jwt"}) @Path("credential") public jakarta.ws.rs.core.Response requestCredential(String requestPayload) Returns a verifiable credential
-