‎2018 Aug 13 7:11 PM
Hi,
I am trying to generate a SAS Token from ABAP to connect to Azure Service Bus as described in the following link
https://docs.microsoft.com/en-us/rest/api/eventhub/generate-sas-token#using-the-shared-access-signat...
I want to convert the below code to ABAP. Kindly, help out.
The Javascript Code is as follows:
function createSharedAccessToken(uri, saName, saKey) {
if (!uri || !saName || !saKey) {
throw"Missing required parameter";
}
var encoded = encodeURIComponent(uri);
var now = newDate();
var week = 60*60*24*7;
var ttl = Math.round(now.getTime() / 1000) + week;
var signature = encoded + '\n' + ttl;
var signatureUTF8 = utf8.encode(signature);
var hash = crypto.createHmac('sha256', saKey).update(signatureUTF8).digest('base64');
return'SharedAccessSignature sr=' + encoded + '&sig=' +
encodeURIComponent(hash) + '&se=' + ttl + '&skn=' + saName;
}
‎2018 Aug 14 10:07 AM
Guess this will work, https://github.com/Microsoft/ABAP-SDK-for-Azure/blob/7de07cdcf35e8ef60a292d1e6f845bfe3bc39394/src/za...
Its part of the Microsoft ABAP SDK for Azure, which you might want to consider using instead of developing it from scratch
‎2018 Aug 14 10:07 AM
Guess this will work, https://github.com/Microsoft/ABAP-SDK-for-Azure/blob/7de07cdcf35e8ef60a292d1e6f845bfe3bc39394/src/za...
Its part of the Microsoft ABAP SDK for Azure, which you might want to consider using instead of developing it from scratch