Class CredentialOfferCreateRequest
- java.lang.Object
-
- com.authlete.common.dto.CredentialOfferCreateRequest
-
- All Implemented Interfaces:
Serializable
public class CredentialOfferCreateRequest extends Object implements Serializable
Request to Authlete's/vci/offer/createAPI.The API is used to create a credential offer.
A credential offer is a JSON object that is used as the value of the
credential_offerparameter sent to the credential offer endpoint of the wallet or is returned from an endpoint designated by thecredential_offer_uriparameter.A credential offer looks like below. Properties in this class (= request parameters to the
/vci/offer/createAPI) are used to control the content of the credential offer being created.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "authorization_code": { "issuer_state": "..." }, "urn:ietf:params:oauth:grant-type:pre-authorized_code": { "pre-authorized_code": "...", "tx_code": { "input_mode": "numeric", "length": 6, "description": "..." } } } }Breaking Changes
The "OpenID for Verifiable Credential Issuance" specification tends to repeat breaking changes. Such changes affect this Java class.
In the past draft of the specification, elements in the "
credentials" array in a credential offer are either strings or JSON objects. Therefore, the type of the "credentials" property in the previous implementation of this class was a "string" whose content must be able to be parsed as a JSON array. However, as a result of a breaking change in the specification, it is ensured that all elements in the "credentials" array in a credential offer are strings. To make it easier to treat the "credentials" property of this class, the type of the property has been changed from a string to an array of strings.Due to another breaking change made in December 2023, the
credentialsproperty in a credential offer has been renamed tocredential_configurations. In addition, theuser_pin_requiredboolean property has been replaced with thetx_codeJSON object.Another breaking change. The
credential_configurationsproperty in a credential offer has been renamed tocredential_configuration_ids. (January, 2024)- Since:
- 3.59, Authlete 3.0
- See Also:
- OpenID for Verifiable Credential Issuance, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CredentialOfferCreateRequest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAcr()Get the Authentication Context Class Reference of the user authentication performed during the course of issuing the credential offer.longgetAuthTime()Get the time when the user authentication was performed during the course of issuing the credential offer.StringgetContext()Get the general-purpose arbitrary string associated with the credential offer.String[]getCredentialConfigurationIds()Get the value of thecredential_configuration_idsarray.longgetDuration()Get the duration of the credential offer in seconds.StringgetJwtAtClaims()Get the additional claims in JSON object format that are added to the payload part of the JWT access token.Property[]getProperties()Get the extra properties associated with the credential offer.StringgetSubject()Get the subject associated with the credential offer.StringgetTxCode()Get the transaction code that should be associated with the credential offer.StringgetTxCodeDescription()Get the description of the transaction code.StringgetTxCodeInputMode()Get the input mode of the transaction code.booleanisAuthorizationCodeGrantIncluded()Get the flag to include theauthorization_codeobject in thegrantsobject.booleanisIssuerStateIncluded()Get the flag to include theissuer_stateproperty in theauthorization_codeobject in thegrantsobject.booleanisPreAuthorizedCodeGrantIncluded()Get the flag to include theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject in thegrantsobject.CredentialOfferCreateRequestsetAcr(String acr)Set the Authentication Context Class Reference of the user authentication performed during the course of issuing the credential offer.CredentialOfferCreateRequestsetAuthorizationCodeGrantIncluded(boolean included)Set the flag to include theauthorization_codeobject in thegrantsobject.CredentialOfferCreateRequestsetAuthTime(long authTime)Set the time when the user authentication was performed during the course of issuing the credential offer.CredentialOfferCreateRequestsetContext(String context)Set the general-purpose arbitrary string associated with the credential offer.CredentialOfferCreateRequestsetCredentialConfigurationIds(String[] ids)Set the value of thecredential_configuration_idsarray.CredentialOfferCreateRequestsetDuration(long duration)Set the duration of the credential offer in seconds.CredentialOfferCreateRequestsetIssuerStateIncluded(boolean included)Set the flag to include theissuer_stateproperty in theauthorization_codeobject in thegrantsobject.CredentialOfferCreateRequestsetJwtAtClaims(String claims)Set the additional claims in JSON object format that are added to the payload part of the JWT access token.CredentialOfferCreateRequestsetPreAuthorizedCodeGrantIncluded(boolean included)Set the flag to include theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject in thegrantsobject.CredentialOfferCreateRequestsetProperties(Property[] properties)Set the extra properties associated with the credential offer.CredentialOfferCreateRequestsetSubject(String subject)Set the subject associated with the credential offer.CredentialOfferCreateRequestsetTxCode(String txCode)Set the transaction code that should be associated with the credential offer.CredentialOfferCreateRequestsetTxCodeDescription(String description)Set the description of the transaction code.CredentialOfferCreateRequestsetTxCodeInputMode(String inputMode)Set the input mode of the transaction code.
-
-
-
Method Detail
-
getCredentialConfigurationIds
public String[] getCredentialConfigurationIds()
Get the value of thecredential_configuration_idsarray.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { ... } }This property is mandatory.
The type of the object returned from this method has been changed from
StringtoString[]since version 3.86 to align with the breaking change of the OID4VCI specification.NOTE: Due to the breaking change made in December 2023, the
credentialsproperty in a credential offer has been renamed tocredential_configurations.Another breaking change. The
credential_configurationsproperty has been renamed tocredential_configuration_ids. (January, 2024)- Returns:
- The value of the
credential_configuration_idsarray. - Since:
- 3.94
-
setCredentialConfigurationIds
public CredentialOfferCreateRequest setCredentialConfigurationIds(String[] ids)
Set the value of thecredential_configuration_idsarray.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { ... } }This property is mandatory.
NOTE: Due to the breaking change made in December 2023, the
credentialsproperty in a credential offer has been renamed tocredential_configurations.Another breaking change. The
credential_configurationsproperty has been renamed tocredential_configuration_ids. (January, 2024)- Parameters:
ids- The value of thecredential_configuration_idsarray.- Returns:
thisobject.- Since:
- 3.94
-
isAuthorizationCodeGrantIncluded
public boolean isAuthorizationCodeGrantIncluded()
Get the flag to include theauthorization_codeobject in thegrantsobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "authorization_code": { ... } } }- Returns:
trueif theauthorization_codeobject will be included.
-
setAuthorizationCodeGrantIncluded
public CredentialOfferCreateRequest setAuthorizationCodeGrantIncluded(boolean included)
Set the flag to include theauthorization_codeobject in thegrantsobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "authorization_code": { ... } } }- Parameters:
included-trueto include theauthorization_codeobject.- Returns:
thisobject.
-
isIssuerStateIncluded
public boolean isIssuerStateIncluded()
Get the flag to include theissuer_stateproperty in theauthorization_codeobject in thegrantsobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "authorization_code": { "issuer_state": "..." } } }When this property is
true, Authlete generates an issuer state and puts it in theauthorization_codeobject as the value of theissuer_stateproperty.- Returns:
trueif theissuer_stateproperty will be included.
-
setIssuerStateIncluded
public CredentialOfferCreateRequest setIssuerStateIncluded(boolean included)
Set the flag to include theissuer_stateproperty in theauthorization_codeobject in thegrantsobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "authorization_code": { "issuer_state": "..." } } }When this property is
true, Authlete generates an issuer state and puts it in theauthorization_codeobject as the value of theissuer_stateproperty.- Parameters:
included-trueto include theissuer_stateproperty.- Returns:
thisobject.
-
isPreAuthorizedCodeGrantIncluded
public boolean isPreAuthorizedCodeGrantIncluded()
Get the flag to include theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject in thegrantsobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "urn:ietf:params:oauth:grant-type:pre-authorized_code": { ... } } }When this property is
true, theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject is included. In addition, Authlete generates a pre-authorized code and puts it in theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject as the value of thepre-authorized_codeproperty. Note that the specification requires that thepre-authorized_codeproperty exist whenever theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject is included.- Returns:
trueif theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject will be included.
-
setPreAuthorizedCodeGrantIncluded
public CredentialOfferCreateRequest setPreAuthorizedCodeGrantIncluded(boolean included)
Set the flag to include theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject in thegrantsobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "urn:ietf:params:oauth:grant-type:pre-authorized_code": { ... } } }When this property is
true, theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject is included. In addition, Authlete generates a pre-authorized code and puts it in theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject as the value of thepre-authorized_codeproperty. Note that the specification requires that thepre-authorized_codeproperty exist whenever theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject is included.- Parameters:
included-trueto include theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject.- Returns:
thisobject.
-
getSubject
public String getSubject()
Get the subject associated with the credential offer.This property is mandatory.
- Returns:
- The subject associated with the credential offer.
-
setSubject
public CredentialOfferCreateRequest setSubject(String subject)
Set the subject associated with the credential offer.This property is mandatory.
- Parameters:
subject- The subject associated with the credential offer.- Returns:
thisobject.
-
getDuration
public long getDuration()
Get the duration of the credential offer in seconds.If this property holds a positive integer, the value is used as the duration of the credential offer being issued. Otherwise, the value of the
credentialOfferDurationproperty of the service is used.- Returns:
- The duration of the credential offer in seconds.
- See Also:
Service.getCredentialOfferDuration()
-
setDuration
public CredentialOfferCreateRequest setDuration(long duration)
Set the duration of the credential offer in seconds.If this property holds a positive integer, the value is used as the duration of the credential offer being issued. Otherwise, the value of the
credentialOfferDurationproperty of the service is used.- Parameters:
duration- The duration of the credential offer in seconds.- Returns:
thisobject.- See Also:
Service.setCredentialOfferDuration(long)
-
getContext
public String getContext()
Get the general-purpose arbitrary string associated with the credential offer.Developers can utilize this property as they like. Authlete does not care about the content.
- Returns:
- The general-purpose arbitrary string.
-
setContext
public CredentialOfferCreateRequest setContext(String context)
Set the general-purpose arbitrary string associated with the credential offer.Developers can utilize this property as they like. Authlete does not care about the content.
- Parameters:
context- The general-purpose arbitrary string.- Returns:
thisobject.
-
getProperties
public Property[] getProperties()
Get the extra properties associated with the credential offer. Extra properties are general-purpose key-value pairs.The extra properties will be eventually associated with an access token which will be created based on the credential offer.
- Returns:
- The extra properties associated with the credential offer.
- Since:
- 3.62
-
setProperties
public CredentialOfferCreateRequest setProperties(Property[] properties)
Set the extra properties associated with the credential offer. Extra properties are general-purpose key-value pairs.The extra properties will be eventually associated with an access token which will be created based on the credential offer.
- Parameters:
properties- The extra properties associated with the credential offer.- Returns:
thisobject.- Since:
- 3.62
-
getJwtAtClaims
public String getJwtAtClaims()
Get the additional claims in JSON object format that are added to the payload part of the JWT access token.This request parameter has a meaning only when the format of access tokens issued by the service is JWT. In other words, it has a meaning only when the
accessTokenSignAlgproperty of theServiceholds a non-null value. See the description of thegetAccessTokenSignAlg()method for details.The additional claims will be eventually associated with an access token which will be created based on the credential offer.
- Returns:
- Additional claims that are added to the payload part of the JWT access token.
- Since:
- 3.62
-
setJwtAtClaims
public CredentialOfferCreateRequest setJwtAtClaims(String claims)
Set the additional claims in JSON object format that are added to the payload part of the JWT access token.This request parameter has a meaning only when the format of access tokens issued by the service is JWT. In other words, it has a meaning only when the
accessTokenSignAlgproperty of theServiceholds a non-null value. See the description of thegetAccessTokenSignAlg()method for details.The additional claims will be eventually associated with an access token which will be created based on the credential offer.
- Parameters:
claims- Additional claims that are added to the payload part of the JWT access token.- Returns:
thisobject.- Since:
- 3.62
-
getAuthTime
public long getAuthTime()
Get the time when the user authentication was performed during the course of issuing the credential offer.- Returns:
- The time of the user authentication in seconds since the Unix epoch.
- Since:
- 3.62
-
setAuthTime
public CredentialOfferCreateRequest setAuthTime(long authTime)
Set the time when the user authentication was performed during the course of issuing the credential offer.- Parameters:
authTime- The time of the user authentication in seconds since the Unix epoch. Must not be negative.- Returns:
thisobject.- Since:
- 3.62
-
getAcr
public String getAcr()
Get the Authentication Context Class Reference of the user authentication performed during the course of issuing the credential offer.- Returns:
- The Authentication Context Class Reference.
- Since:
- 3.62
-
setAcr
public CredentialOfferCreateRequest setAcr(String acr)
Set the Authentication Context Class Reference of the user authentication performed during the course of issuing the credential offer.- Parameters:
acr- The Authentication Context Class Reference.- Returns:
thisobject.- Since:
- 3.62
-
getTxCode
public String getTxCode()
Get the transaction code that should be associated with the credential offer.If this parameter is not empty and the
preAuthorizedCodeGrantIncludedparameter is true, theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject will include thetx_codeobject.The length of the value of this parameter will be used as the value of the
lengthproperty in thetx_codeobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "urn:ietf:params:oauth:grant-type:pre-authorized_code": { "pre-authorized_code": "...", "tx_code": { "length": length } } } }- Returns:
- The transaction code.
- Since:
- 3.91
-
setTxCode
public CredentialOfferCreateRequest setTxCode(String txCode)
Set the transaction code that should be associated with the credential offer.If this parameter is not empty and the
preAuthorizedCodeGrantIncludedparameter is true, theurn:ietf:params:oauth:grant-type:pre-authorized_codeobject will include thetx_codeobject.The length of the value of this parameter will be used as the value of the
lengthproperty in thetx_codeobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "urn:ietf:params:oauth:grant-type:pre-authorized_code": { "pre-authorized_code": "...", "tx_code": { "length": length } } } }- Parameters:
txCode- The transaction code.- Returns:
thisobject.- Since:
- 3.91
-
getTxCodeInputMode
public String getTxCodeInputMode()
Get the input mode of the transaction code.The value of this property will be used as the value of the
input_modeproperty in thetx_codeobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "urn:ietf:params:oauth:grant-type:pre-authorized_code": { "pre-authorized_code": "...", "tx_code": { "length": length, "input_mode": "..." } } } }- Returns:
- The input mode of the transaction code.
- Since:
- 3.91
-
setTxCodeInputMode
public CredentialOfferCreateRequest setTxCodeInputMode(String inputMode)
Set the input mode of the transaction code.The value of this property will be used as the value of the
input_modeproperty in thetx_codeobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "urn:ietf:params:oauth:grant-type:pre-authorized_code": { "pre-authorized_code": "...", "tx_code": { "length": length, "input_mode": "..." } } } }Possible values listed in the current draft of the OID4VCI specification are "
numeric" and "text" only, but the/vci/offer/createAPI accepts other values for the future extension in addition to the predefined ones.- Parameters:
inputMode- The input mode of the transaction code.- Returns:
thisobject.- Since:
- 3.91
-
getTxCodeDescription
public String getTxCodeDescription()
Get the description of the transaction code.The value of this property will be used as the value of the
descriptionproperty in thetx_codeobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "urn:ietf:params:oauth:grant-type:pre-authorized_code": { "pre-authorized_code": "...", "tx_code": { "length": length, "description": "..." } } } }- Returns:
- The description of the transaction code.
- Since:
- 3.91
-
setTxCodeDescription
public CredentialOfferCreateRequest setTxCodeDescription(String description)
Set the description of the transaction code.The value of this property will be used as the value of the
descriptionproperty in thetx_codeobject.{ "credential_issuer": "...", "credential_configuration_ids": [ ... ], "grants": { "urn:ietf:params:oauth:grant-type:pre-authorized_code": { "pre-authorized_code": "...", "tx_code": { "length": length, "description": "..." } } } }- Parameters:
description- The description of the transaction code. The length of the description must not exceed 300.- Returns:
thisobject.- Since:
- 3.91
-
-