I want to do something like this
<arc:set attr=“scope”>[encodedurl]\n[expiry]</arc:set>
I have tried using a multiline arc:set but without any luck
<arc:set attr=“scope”>
[encodedurl]
[expiry]
</arc:set>
Any ideas?
I want to do something like this
<arc:set attr=“scope”>[encodedurl]\n[expiry]</arc:set>
I have tried using a multiline arc:set but without any luck
<arc:set attr=“scope”>
[encodedurl]
[expiry]
</arc:set>
Any ideas?
What context are you using the new scope attr in? Both of those statements will use a new line in the resulting value, which you can see if you test it in a Script connector for example:
<arc:set attr="encodedurl" value="http://someurl/" /><arc:set attr="expiry" value="2020-01-01" /><arc:set attr="scope">[encodedurl]\n[expiry]</arc:set><arc:throw code="x" desc="[scope]" />
You can see the line break in the thrown exception:

And in the second case, you get the preceding and following line breaks:
<arc:set attr="encodedurl" value="http://someurl/" /><arc:set attr="expiry" value="2020-01-01" /><arc:set attr="scope"> [encodedurl] [expiry]</arc:set><arc:throw code="x" desc="[scope]" />

Of course, the context from which scope is evaluated is important here, because the exception here supports multiline data.
I’m using the scope and encoding it using HMACs.
I then pass it in the message header to a REST connector and use it in a HTTP Header
The REST Connector log shows these two headers being evaluated correctly.
Very similar to https://arc.cdata.com/kb/articles/arc-http-signature-auth.rst
Here’s my script
<arc:set attr="encIn0.data" value="[url]" /><arc:set attr="encIn0.format" value="URL" /><arc:call op="encEncode" in="encIn2" out="result0"> <!-- setting the output file data to be the encoded data returned from the operation --> <arc:set attr="output.encodedurl">[result0.encodeddata]</arc:set></arc:call><arc:set attr="fixedtimestamp" value="03-02-2024"/><arc:set attr="expiry">[fixedtimestamp| todate('dd-MM-yyyy','U') |dateadd('day', 7)|datediff('second', '1970-01-01 00:00:00Z')]</arc:set><arc:set attr="scope">[output.encodedurl]\n[expiry]</arc:set><arc:set attr="encIn.data" value="[scope]" /><arc:set attr="encIn.format" value="HMAC" /><arc:set attr="encIn.hmackey" value="[azureprimary.key]" /><arc:set attr="encIn.hmacalgorithm" value="SHA" /><arc:set attr="encIn.hmacbits" value="256" /><arc:set attr="encIn.outformat" value="BASE64" /><arc:call op="encEncode" in="encIn" out="result"> <!-- setting the output file data to be the encoded data returned from the operation --> <arc:set attr="output.hashb64">[result.encodeddata]</arc:set></arc:call><arc:set attr="encIn2.data" value="[output.hashb64]" /><arc:set attr="encIn2.format" value="URL" /><arc:call op="encEncode" in="encIn2" out="result2"> <!-- setting the output file data to be the encoded data returned from the operation --> <arc:set attr="output.signatureUrlEncoded">[result2.encodeddata]</arc:set></arc:call><arc:set attr="sigheader">SharedAccessSignature sig=[output.signatureUrlEncoded]&se=[expiry]&skn=sas-tracking-events-topic&sr=[output.encodedurl]</arc:set><arc:set attr="outfile.FilePath" value="[FilePath]" /><!-- debug --><arc:set attr="outfile.Header:expiry">[expiry]</arc:set><arc:set attr="outfile.Header:scope">[scope]</arc:set><arc:set attr="outfile.Header:signature">[output.hashb64]</arc:set><!-- debug end--><arc:set attr="outfile.Header:sigheader" value="[sigheader]" /><arc:set attr="outfile.Header:brokerProperties">{"SessionId":"[guid()]"}</arc:set><arc:push item="outfile" />
The issues is with
<arc:set attr="encIn0.data" value="[url]" /><arc:set attr="encIn0.format" value="URL" /><arc:call op="encEncode" in="encIn0" out="result0"> <!-- setting the output file data to be the encoded data returned from the operation --> <arc:set attr="output.encodedurl">[result0.encodeddata]</arc:set></arc:call>
It’s encode //:, = etc to lowercase (%2f, %3d etc). I’m comparing this with Postman and Crypto JS which encodes to uppercase (and works)
All solved and working now