Class CredentialBatchParseResponse
- java.lang.Object
-
- com.authlete.common.dto.ApiResponse
-
- com.authlete.common.dto.CredentialBatchParseResponse
-
- All Implemented Interfaces:
Serializable
public class CredentialBatchParseResponse extends ApiResponse
Response from the/vci/batch/parseAPI.The response from the Authlete API is a JSON object and can be mapped to this class. The API caller should retrieve the value of the
actionparameter from the API response and take one of the following actions accordingly.
action=OKThe
actionvalueOKmeans that the batch credential request is valid. In this case, the implementation of the batch credential endpoint should call the/vci/batch/issueAPI in order to issue verifiable credentials and/or transaction IDs and generate a response to the request sender.
action=BAD_REQUESTThe
actionvalueBAD_REQUESTmeans that the batch credential request is invalid. In this case, the implementation of the batch 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 theresponseContentparameter can be used as the message body of the error response as it conforms to the specification of "Batch 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=UNAUTHORIZEDThe
actionvalueUNAUTHORIZEDmeans that the access token is invalid. In this case, the implementation of the batch 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 theresponseContentparameter can be used as the value of theWWW-AuthenticateHTTP header of the error response.HTTP/1.1 401 Unauthorized WWW-Authenticate: (Put the value of the "responseContent" parameter here.)
Note that the implementation of the batch credential endpoint should call the
/auth/introspectionAPI to check whether the access token is valid BEFORE calling the/vci/batch/parseAPI. The validation on the access token by the/vci/batch/parseAPI is limited and not exhaustive. For example, the/vci/batch/parseAPI does not check certificate binding (RFC 8705).
action=FORBIDDENThe
actionvalueFORBIDDENmeans that the use of the Authlete API is forbidden. In this case, the implementation of the batch 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 theresponseContentparameter can be used as the message body of the error response as it conforms to the specification of "Batch 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
verifiableCredentialsEnabledproperty of theserviceis 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_ERRORThe
actionvalueINTERNAL_SERVER_ERRORmeans that something wrong happened on Authlete side. In this case, the implementation of the batch 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 theresponseContentparameter can be used as the message body of the error response as it conforms to the specification of "Batch 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.
- Since:
- 3.71, Authlete 3.0
- See Also:
- OpenID for Verifiable Credential Issuance, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCredentialBatchParseResponse.ActionThe next action that the implementation of the batch credential endpoint should take.
-
Constructor Summary
Constructors Constructor Description CredentialBatchParseResponse()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CredentialBatchParseResponse.ActiongetAction()Get the next action that the batch credential endpoint should take.CredentialRequestInfo[]getInfo()Get information about the credential requests in the batch credential request.StringgetResponseContent()Get the content of the response that should be returned to the request sender.CredentialBatchParseResponsesetAction(CredentialBatchParseResponse.Action action)Set the next action that the batch credential endpoint should take.CredentialBatchParseResponsesetInfo(CredentialRequestInfo[] info)Set information about the credential requests in the batch credential request.CredentialBatchParseResponsesetResponseContent(String content)Set the content of the response that should be returned to the request sender.-
Methods inherited from class com.authlete.common.dto.ApiResponse
getResponseHeaders, getResultCode, getResultMessage, setResponseHeaders, setResultCode, setResultMessage
-
-
-
-
Method Detail
-
getAction
public CredentialBatchParseResponse.Action getAction()
Get the next action that the batch credential endpoint should take.- Returns:
- The next action that the batch credential endpoint should take.
-
setAction
public CredentialBatchParseResponse setAction(CredentialBatchParseResponse.Action action)
Set the next action that the batch credential endpoint should take.- Parameters:
action- The next action that the batch credential endpoint should take.- Returns:
thisobject.
-
getResponseContent
public String getResponseContent()
Get the content of the response that should be returned to the request sender. The format varies depending on the value of theactionparameter.When the value of the
actionparameter isOK, the value of this parameter is null.When the value of the
actionparameter isUNAUTHORIZED, the value of this parameter is a string suitable as the value of theWWW-AuthenticateHTTP header.In other error cases, the value of this parameter is JSON that conforms to the specification of "Batch Credential Error Response".
- Returns:
- The content of the response that should be returned to the request sender.
-
setResponseContent
public CredentialBatchParseResponse setResponseContent(String content)
Set the content of the response that should be returned to the request sender. The format varies depending on the value of theactionparameter.When the value of the
actionparameter isOK, the value of this parameter should be null.When the value of the
actionparameter isUNAUTHORIZED, the value of this parameter should be a string suitable as the value of theWWW-AuthenticateHTTP header.In other error cases, the value of this parameter should be JSON that conforms to the specification of "Batch Credential Error Response".
- Parameters:
content- The content of the response that should be returned to the request sender.- Returns:
thisobject.
-
getInfo
public CredentialRequestInfo[] getInfo()
Get information about the credential requests in the batch credential request.- Returns:
- Information about the credential requests.
-
setInfo
public CredentialBatchParseResponse setInfo(CredentialRequestInfo[] info)
Set information about the credential requests in the batch credential request.- Parameters:
info- Information about the credential requests.- Returns:
thisobject.
-
-