diff --git a/EnvelopeGenerator.API/Extensions/ReceiverClaimExtensions.cs b/EnvelopeGenerator.API/Extensions/ReceiverClaimExtensions.cs
index 05f3c878..b3760d59 100644
--- a/EnvelopeGenerator.API/Extensions/ReceiverClaimExtensions.cs
+++ b/EnvelopeGenerator.API/Extensions/ReceiverClaimExtensions.cs
@@ -12,6 +12,7 @@ namespace EnvelopeGenerator.API.Extensions;
public static class ReceiverClaimExtensions
{
private static readonly string[] EnvelopeIdClaimTypes = [EnvelopeClaimTypes.Id, "envelope_id", "EnvelopeId"];
+ private static readonly string[] ReceiverIdClaimTypes = ["receiver_id", "ReceiverId"];
private static readonly string[] EnvelopeUuidClaimTypes = [ClaimTypes.NameIdentifier, "envelope_uuid", "EnvelopeUuid"];
private static readonly string[] ReceiverSignatureClaimTypes = [ClaimTypes.Hash, "receiver_sig", "ReceiverSignature"];
@@ -81,12 +82,29 @@ public static class ReceiverClaimExtensions
var envIdStr = user.GetRequiredClaimOfReceiver(EnvelopeIdClaimTypes);
if (!int.TryParse(envIdStr, out var envId))
{
- throw new InvalidOperationException($"Claim '{EnvelopeClaimTypes.Id}' is not a valid integer.");
+ throw new InvalidOperationException($"Claim '{"envelope_id"}' is not a valid integer.");
}
return envId;
}
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static int GetReceiverIdOfReceiver(this ClaimsPrincipal user)
+ {
+ var rcvIdStr = user.GetRequiredClaimOfReceiver(ReceiverIdClaimTypes);
+ if (!int.TryParse(rcvIdStr, out var rcvId))
+ {
+ throw new InvalidOperationException($"Claim '{"receiver_id"}' is not a valid integer.");
+ }
+
+ return rcvId;
+ }
+
///
/// Signs in an envelope receiver using cookie authentication and attaches envelope claims.
///