Class CredentialSingleIssueResponse
- java.lang.Object
-
- com.authlete.common.dto.ApiResponse
-
- com.authlete.common.dto.CredentialSingleIssueResponse
-
- All Implemented Interfaces:
Serializable
public class CredentialSingleIssueResponse extends ApiResponse
A response from Authlete's/vci/single/issue
API.A response from the
/vci/single/issue
API can be mapped to this class. The API caller should extract the value of theaction
parameter from the API response and take the next action based on the value of the parameter.
action
=OK
The
action
valueOK
means that a credential has been issued successfully. In this case, the implementation of the credential endpoint should return a successful response to the request sender. The HTTP status code and the content type of the response should be 200 andapplication/json
, respectively. The value of theresponseContent
parameter can be used as the message body of the response. It contains the "credential
" parameter that conforms to the specification of "Credential Response".HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-store (Put the value of the "responseContent" parameter here.)
action
=OK_JWT
The
action
valueOK_JWT
means that a credential has been issued successfully and the credential response should be encrypted. In this case, the implementation of the credential endpoint should return a successful response to the request sender. The HTTP status code and the content type of the response should be 200 andapplication/jwt
, respectively. The value of theresponseContent
parameter is an encrypted JWT and can be used as the message body of the response.The
OK_JWT
action is returned when the successful credential response is encrypted.HTTP/1.1 200 OK Content-Type: application/jwt Cache-Control: no-store (Put the value of the "responseContent" parameter here.)
action
=ACCEPTED
The
action
valueACCEPTED
means that a transaction ID has been issued successfully. In this case, the implementation of the credential endpoint should return a successful response to the request sender. The HTTP status code and the content type of the response should be 202 andapplication/json
, respectively. The value of theresponseContent
parameter can be used as the message body of the response. It contains the "transaction_id
" parameter that conforms to the specification of "Credential Response".HTTP/1.1 202 Accepted Content-Type: application/json Cache-Control: no-store (Put the value of the "responseContent" parameter here.)
action
=ACCEPTED_JWT
The
action
valueACCEPTED_JWT
means that a transaction ID has been issued successfully and the credential response should be encrypted. In this case, the implementation of the credential endpoint should return a successful response to the request sender. The HTTP status code and the content type of the response should be 202 andapplication/jwt
, respectively. The value of theresponseContent
parameter is an encrypted JWT and can be used as the message body of the response.HTTP/1.1 202 Accepted Content-Type: application/jwt Cache-Control: no-store (Put the value of the "responseContent" parameter here.)
action
=UNAUTHORIZED
The
action
valueUNAUTHORIZED
means that the access token is invalid. In this case, the implementation of the credential endpoint should return an error response to the request sender. The HTTP status code of the error response should be 401. The value of theresponseContent
parameter can be used as the value of theWWW-Authenticate
HTTP header of the error response.HTTP/1.1 401 Unauthorized WWW-Authenticate: (Put the value of the "responseContent" parameter here.)
It is unlikely that this action is returned if the access token is the same one as was passed to the
/vci/single/parse
API and the API had returned a successful response.
action
=BAD_REQUEST
The
action
valueBAD_REQUEST
means that the original credential request is wrong. In this case, the implementation of the credential endpoint should return an error response to the request sender. The HTTP status code and the content type of the error response should be 400 andapplication/json
, respectively. The value of theresponseContent
parameter can be used as the message body of the error response as it conforms to the specification of "Credential Error Response".HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store (Put the value of the "responseContent" parameter here.)
action
=FORBIDDEN
The
action
valueFORBIDDEN
means that the use of the Authlete API is forbidden. In this case, the implementation of the credential endpoint should return an error response to the request sender. The HTTP status code and the content type of the error response should be 403 andapplication/json
, respectively. The value of theresponseContent
parameter can be used as the message body of the error response as it conforms to the specification of "Credential Error Response".HTTP/1.1 403 Forbidden Content-Type: application/json Cache-Control: no-store (Put the value of the "responseContent" parameter here.)
Note that this happens either when the
verifiableCredentialsEnabled
property of theservice
is false or when the Authlete server does not support the feature of "Verifiable Credentials". In either case, this "forbidden" issue should be solved before the service is deployed in a production environment.
action
=INTERNAL_SERVER_ERROR
The
action
valueINTERNAL_SERVER_ERROR
means that something wrong happened on Authlete side. In this case, the implementation of the credential endpoint should return an error response to the request sender. The HTTP status code and the content type of the error response should be 500 andapplication/json
, respectively. The value of theresponseContent
parameter can be used as the message body of the error response as it conforms to the specification of "Credential Error Response".HTTP/1.1 500 Internal Server Error Content-Type: application/json Cache-Control: no-store (Put the value of the "responseContent" parameter here.)
Note that, however, in real production deployments, it may be better to return a vaguer error response instead of a bare one like above.
action
=CALLER_ERROR
The
action
valueCALLER_ERROR
means that the API call is wrong. For example, the "order
" request parameter is missing.Caller errors should be solved before the service is deployed in a production environment.
- Since:
- 3.67, Authlete 3.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CredentialSingleIssueResponse.Action
The next action that the implementation of the credential endpoint should take.
-
Constructor Summary
Constructors Constructor Description CredentialSingleIssueResponse()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CredentialSingleIssueResponse.Action
getAction()
Get the next action that the implementation of the credential endpoint should take.String
getResponseContent()
Get the content of the response that the implementation of the credential endpoint should return.String
getTransactionId()
Get the issued transaction ID.CredentialSingleIssueResponse
setAction(CredentialSingleIssueResponse.Action action)
Set the next action that the implementation of the credential endpoint should take.CredentialSingleIssueResponse
setResponseContent(String responseContent)
Set the content of the response that the implementation of the credential endpoint should return.CredentialSingleIssueResponse
setTransactionId(String transactionId)
Set the issued transaction ID.-
Methods inherited from class com.authlete.common.dto.ApiResponse
getResultCode, getResultMessage, setResultCode, setResultMessage
-
-
-
-
Method Detail
-
getAction
public CredentialSingleIssueResponse.Action getAction()
Get the next action that the implementation of the credential endpoint should take.- Returns:
- The next action.
-
setAction
public CredentialSingleIssueResponse setAction(CredentialSingleIssueResponse.Action action)
Set the next action that the implementation of the credential endpoint should take.- Parameters:
action
- The next action.- Returns:
this
object.
-
getResponseContent
public String getResponseContent()
Get the content of the response that the implementation of the credential endpoint should return.- Returns:
- The content of the response returned from the credential endpoint.
-
setResponseContent
public CredentialSingleIssueResponse setResponseContent(String responseContent)
Set the content of the response that the implementation of the credential endpoint should return.- Parameters:
responseContent
- The content of the response returned from the credential endpoint.- Returns:
this
object.
-
getTransactionId
public String getTransactionId()
Get the issued transaction ID.A transaction ID is issued when the
issuanceDeferred
boolean flag of the credential order (CredentialIssuanceOrder
) is true.The transaction ID is expected to be presented at the deferred credential endpoint.
- Returns:
- The issued transaction ID.
-
setTransactionId
public CredentialSingleIssueResponse setTransactionId(String transactionId)
Set the issued transaction ID.A transaction ID is issued when the
issuanceDeferred
boolean flag of the credential order (CredentialIssuanceOrder
) is true.The transaction ID is expected to be presented at the deferred credential endpoint.
- Parameters:
transactionId
- The issued transaction ID.- Returns:
this
object.
-
-