Skip to main content

UK JWS Header Processing Policy

UK JWS Header Processing Policy is a policy designed to be engaged in the request flow of any request that requires the JWS signature header to be validated prior to an API resource call and to be appended a JWS signature header in the response. This is a Open Banking UK specific implementation and can be used as a reference to develop custom JWS requirements. It will perform the below tasks.

  • Validates the JWS signature header as mentioned in the UK specification
  • Appends a JWS signature header in the response as mentioned in the UK specification

Before creating policies, you need to build the policy artifacts from the source.

Building from the source​

If you want to build the Financial Services APIM Mediation Policies from the source code:

  1. Install Java 11 or above.

  2. Install Apache Maven 3.0.5 or above.

  3. Get the Financial Services APIM Mediation Policies from this repository by cloning or downloading the repository as a zip.

    • To clone the solution, copy the URL and execute the following command in a command prompt. git clone <the copiedURL>. After cloning, checkout to the main branch.
    • To download the repository, select the main branch first, then click Download ZIP and unzip the downloaded file.
  4. Navigate to the cloned/downloaded repository using a command prompt and run the relevant Maven command:

CommandDescription
mvn installThis starts building the repository without cleaning the folders.
mvn clean installThis cleans the folders and starts building the repository from scratch.

How to use mediation artifacts​

  1. Once the maven build is successful, navigate to the fs-apim-mediation-artifacts/target folder to get the zip file containing all the mediation policies,custom sequences and class mediators & handlers to copy in to WSO2 API Manager.

  2. Extract the zip 'fs-apim-mediation-artifacts-1.0.0.zip' and you will notice the following folder structure.

    • Policy .j2 files - The mediation policy files which need to upload in API Publisher UI and engage to APIs. Below mediation policies are available in this repository.
    • Custom sequences- Synapse based custom sequence files which need to copy in to <APIM_HOME>/repository/deployment/server/synapse-configs/default/sequences folder.
    • lib - This folder contains the jars need to copy in to <APIM_Home>/repository/components/lib folder. It contains jars of the class mediator implementations refer from the policies and custom synapse handler implementations.
  3. Add the following configuration to deployment.toml file inside the <APIM_Home>/repository/conf folder.

[synapse_handlers.jws_response_signature_handler]
enabled = true
class = "org.wso2.financial.services.apim.mediation.policies.jws.header.processing.handlerJwsResponseHeaderHandler"
  1. Restart the API Manager Server.

Create an API Level Policy by following the Creating API Level Policy and add to all API resources which require JWS request header processing. Find the details to create the policy below.

General Details​

FieldDescription
NameUK JWS Header Processing Policy
Version1 (can be any)
DescriptionPolicy to process the JWS header
Applicable FlowsRequest
Supported API TypesHTTP

Policy File​

Upload the jwsHeaderProcessingPolicy.j2 policy file which resides inside the extracted fs-apim-mediation-artifacts-1.0.0.zip built in above section.

Policy Attributes​

Attribute NameDisplay NameDescriptionRequiredTypeExample Values
applicationServiceBasicAuthCredentialsApplication Service Basic Auth CredentialsBase64 encoded(admin-username:admin-password) basic auth credentials required to access the application servicetrueStringaXNfYWRtaW5Ad3NvMi5jb206d3NvMjEyMw==
identityServerBaseUrlIdentity Server Base URLBase URL of the identity servertrueStringhttps://localhost:9446
jwSignatureHeaderNameJWS Header NameThe name of the signature header coming in the request and to be included in the responsetrueStringx-jws-signature
requestValidationTrustAnchorTrusted Trust Anchor claimTrusted trust anchor for validating the JWS header tan claimtrueStringopenbanking.org.uk
jwsSupportedAlgorithmsJWS Supported AlgorithmsComma separated list of algorithms that are supported to validate the request JWS signature headertrueStringPS256, RS256
jwsSigningCertAliasJWS Signing Certificate AliasThe alias of the signing certificate which will be used to sign the JWS response headertrueStringwso2carbon
jwsSigningKeyIdJWS Signing Key IDThe key ID to identify the signing key to be used when signing the JWS response headertrueString1234
jwsSigningOrgIdJWS Signing Organization IDThe organization ID to be included in the response JWS headertrueString0015800001HQQrZAAX
jwsSigningAlgorithmJWS Signing AlgorithmThe algorithm to be used when signing the response JWS headertrueStringPS256
responseSigningTrustAnchorTrust Anchor of The ASPSPTrust anchor of the ASPSP to be included in the JWS response headertrueStringopenbanking.org.uk

Was this page helpful?