JamesBowen
19+ years progress programming and still learning.
OE: 11.7
I'm using the PASOE Web transport.
I need to authenticate the incoming request by cross-checking the HTTP header value "X-WC-Webhook-Signature":U
I need the be able to get the poRequest:Entity value in the memptr unaltered.
Currently, it [poRequest:Entity] is in a JSON construct and can't be cast to a ByteBucket.
The reason for the request body to be loaded into a memptr is so that I can perform a message-digest() function over it and match the has value.
Fragment of my code
I'm using the PASOE Web transport.
I need to authenticate the incoming request by cross-checking the HTTP header value "X-WC-Webhook-Signature":U
I need the be able to get the poRequest:Entity value in the memptr unaltered.
Currently, it [poRequest:Entity] is in a JSON construct and can't be cast to a ByteBucket.
The reason for the request body to be loaded into a memptr is so that I can perform a message-digest() function over it and match the has value.
Fragment of my code
Code:
lcWebhookSignature = poRequest:GetHeader("X-WC-Webhook-Signature":U):value.
message "X-WC-Webhook-Signature" lcWebhookSignature.
assign
objRawResponse = cast(poRequest:Entity, ByteBucket) <--Error: "Invalid cast from Progress.Json.ObjectModel.JsonObject to OpenEdge.Core.ByteBucket. (12869) (12869)"
objRawPayload = objRawResponse:GetBytes().
message substitute("HMAC-SHA-256 &1 bytes", objRawResponse:size).
lcCalculatedSignature = string(base64-encode(message-digest("HMAC-SHA-256", objRawPayload:value, chConsumerSecret))).
message "Calculated Signature" lcCalculatedSignature.