Consent Validate

WSO2 Open Banking Accelerator consists of endpoints to manage consents. You can customize relevant components according to your requirements using the extension points available. This section explains the Consent Validate component and how to customize the /validate endpoint.

The Consent Validate implements the validations that are required when the resource endpoints are invoked with a user access token. The ConsentValidateData object provides data such as the request path, detailed consent to perform necessary validations.

An object named ConsentValidationResult is also passed to this extension. It carries the validation details and contains a property that specifies whether the request is valid or not. By default, the value is set to false. If the validation fails, the error message is sent as the response. Here, you can also configure the error code, response code as well as a custom error payload. If you have set modifiedPayload, it is prioritized over a generic error response.

Given below is a summary of details related to this extension.






The following method is available in the interface.

public void validate(ConsentValidateData consentValidateData, ConsentValidationResult consentValidationResult) throws ConsentException;

Error Handling

In any of the consent extensions, if an error scenario occurs and you need to send an error response make sure to throw a ConsentException.


The following table explains the data available in ConsentValidateData.

Name Type Description
headers JSONObject The request headers sent in the request.
body JSONObject The payload sent in the request.
electedResource String The path invoked in the request. For example: /accounts/{AccountId}
consentId String The consent ID related to the current resource request. This consent ID is bound to the user access token used.
userId String The user ID related to the current resource request. This user ID is retrieved from the user access token.
clientId String The ID of the TPP application related to the current resource request. This client ID is retrieved from the user access token.
comprehensiveConsent DetailedConsentResource The comprehensive consent object related to the consent that is being validated. This object contains all the details related to the consent.
resourceParams Map A map containing the full resource path with query parameters (ex: aisp/accounts/{AccountId}?queryParam=urlEncodedQueryParamValue), HTTP method, and context (ex: /open-banking/v3.1/aisp) of the request.

The following table explains the data available in ConsentValidationResult.

Name Type Description
isValid boolean An attribute to identify whether the consent is in a valid state or not.
modifiedPayload JSONObject Optionally used to set a modified error payload to be sent with the consent validation response. If a modified payload is set, it is given priority over creating a generic error response using the message and code information.
consentInformation JSONObject Used to set the consent data to the consent validation result. This data will be sent to the bank backend.


To configure the customized Consent Validate component, follow the steps below:

  1. Open the <IS_HOME>/repository/conf/deployment.toml file.

  2. Add the following tag and configure it with the customized component.


  3. Configure the certificate alias available in the truststore of the Identity Server. This should be the certificate that is used to sign the consent validate JWT, which is sent from the gateway.



    Given below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DcQCjmKv6wlmCvEHR9WKaSTZ2qz5R4zPEJbM-5fOq3F27x_qWEEURgAGVIh3f2v_fOwjdknQ-9bDxhQPcNaNHmUq4XICCOuxYcTi3tYzsw9DQT8qCv2j2K4X71p5h5WFkqn_iG1gLV9izEp-Xvpsxg4vAfZ5Lqu4ADrQMuPQlrIUCbQ",
          "Content-Type":"application\/json; charset=UTF-8"
            "Data": {
                "Permissions": [
                "ExpirationDateTime": "2021-08-21T12:55:29.279+05:30",
                "TransactionFromDateTime": "2021-08-16T12:55:29.331+05:30",
                "TransactionToDateTime": "2021-08-19T12:55:29.331+05:30"
            "Risk": {
       "userId":"[email protected]@[email protected]",

    All header values including the bearer token is included in header.