Interface DataToSignProvider


  • public interface DataToSignProvider
    Provides converter to map request to its string canonical form. String canonical form of the request data is concatenated (in order):
    1. request path + '&' delimiter
    2. request headers in alphabetical order each with '&' delimiter
    3. request query parameters in alphabetical order each with + '&' delimiter
    4. request body
    For example:
    • POST /payment?auth=8799879798&from=anton.brueckner
    • Headers:
    • Amount=13.00
    • SourceIban=1231242314
    • Body:
    • <payment><id>1234</id></payment>
    Has canonical string:
    • /payment&Amount=13.00&SourceIban=1231242314&auth=8799879798&from=anton.brueckner&body=<payment><id>1234</id></payment>
    Another example:
    • POST /payment?auth=8799879798&from=anton.brueckner
    • Headers:
    • Amount=13.00
    • SourceIban=1231242314
    Has canonical string:
    • /payment&Amount=13.00&SourceIban=1231242314&auth=8799879798&from=anton.brueckner&
    Short canonical form of the request data is: Note: Technically hash strength other than collision resistance is not of much importance here as the value is going to be signed with JWS
    • Method Detail

      • withBasePath

        DataToSignProvider withBasePath​(String basePath)
        Changes base request path. For example, consider that endpoint is running at http://example.com/open-banking/payments and target endpoint is /payments - we don't want to include 'open-banking' in request signature. Then you can do withBasePath("/open-banking") to get desired result.
        Parameters:
        basePath - Request base path
        Returns:
        Converter that will ignore base path segment
      • normalizerFor

        RequestDataToSignNormalizer normalizerFor​(RequestToSign toSign)
        Returns signer for the given request that can compute canonical request string
        Parameters:
        toSign - Request to sign
        Returns:
        Signer for the request