base64url encoding in message template function

any ideas if I can define my own message template function? 

i am having the following code, defined for a HMAC signature calculator. 

 <AssignVariable>
        <Name>hmac.stringToSign</Name>
        <Template>{request.header.X-Request-DB-ID}:{encodeBase64(sha256Hex(request.content))}</Template>
    </AssignVariable>

 I would like to use a base64Url encoding instead of base64 without having to do too many changes in my code.  I simplified the use case here to get to the root of the problem. 

The template is defined in a PropertySet and is read from there. The string to sign is a concatenation of many other fields/headers and data.

0 3 334
3 REPLIES 3

I think I addressed your question about base64url encoding in your other post. 

 

@dchiesa1 My other question was reffering to the hmac function within messagetemplate.

Here i am referring to the capability of obtaining 

base64URLencoded(sha256(bodyPayload)).  //check the provided template and have in mind that this function here is just a small part of what I want to have as a stringToSign in the end

ok I see.

Yes, there is no static function in the messagetemplate that does base64url encoding. 

You can use this to accomplish that: https://github.com/DinoChiesa/Apigee-Java-Simple-Base64