diff --git a/EnvelopeGenerator.API/Controllers/AnnotationController.cs b/EnvelopeGenerator.API/Controllers/AnnotationController.cs index f8c8cff6..940dd911 100644 --- a/EnvelopeGenerator.API/Controllers/AnnotationController.cs +++ b/EnvelopeGenerator.API/Controllers/AnnotationController.cs @@ -59,8 +59,8 @@ public class AnnotationController : ControllerBase [Obsolete("PSPDF Kit will no longer be used.")] public async Task CreateOrUpdate([FromBody] PsPdfKitAnnotation? psPdfKitAnnotation = null, CancellationToken cancel = default) { - var signature = User.GetAuthReceiverSignature(); - var uuid = User.GetAuthEnvelopeUuid(); + var signature = User.GetReceiverSignatureOfReceiver(); + var uuid = User.GetEnvelopeUuidOfReceiver(); var envelopeReceiver = await _mediator.ReadEnvelopeReceiverAsync(uuid, signature, cancel).ThrowIfNull(Exceptions.NotFound); @@ -92,9 +92,9 @@ public class AnnotationController : ControllerBase [Obsolete("Use MediatR")] public async Task Reject([FromBody] string? reason = null) { - var signature = User.GetAuthReceiverSignature(); - var uuid = User.GetAuthEnvelopeUuid(); - var mail = User.GetAuthReceiverMail(); + var signature = User.GetReceiverSignatureOfReceiver(); + var uuid = User.GetEnvelopeUuidOfReceiver(); + var mail = User.GetReceiverMailOfReceiver(); var envRcvRes = await _envelopeReceiverService.ReadByUuidSignatureAsync(uuid: uuid, signature: signature); diff --git a/EnvelopeGenerator.API/Controllers/ReadOnlyController.cs b/EnvelopeGenerator.API/Controllers/ReadOnlyController.cs index 64ae1c15..8592e1be 100644 --- a/EnvelopeGenerator.API/Controllers/ReadOnlyController.cs +++ b/EnvelopeGenerator.API/Controllers/ReadOnlyController.cs @@ -40,14 +40,14 @@ public class ReadOnlyController : ControllerBase [Authorize(Roles = Role.Receiver.FullyAuth)] public async Task CreateAsync([FromBody] EnvelopeReceiverReadOnlyCreateDto createDto) { - var authReceiverMail = User.GetAuthReceiverMail(); + var authReceiverMail = User.GetReceiverMailOfReceiver(); if (authReceiverMail is null) { _logger.LogError("EmailAddress claim is not found in envelope-receiver-read-only creation process. Create DTO is:\n {dto}", JsonConvert.SerializeObject(createDto)); return Unauthorized(); } - var envelopeId = User.GetAuthEnvelopeId(); + var envelopeId = User.GetEnvelopeIdOfReceiver(); createDto.AddedWho = authReceiverMail; createDto.EnvelopeId = envelopeId; diff --git a/EnvelopeGenerator.API/Extensions/EnvelopeAuthExtensions.cs b/EnvelopeGenerator.API/Extensions/EnvelopeAuthExtensions.cs index d19ec95f..0a7985d6 100644 --- a/EnvelopeGenerator.API/Extensions/EnvelopeAuthExtensions.cs +++ b/EnvelopeGenerator.API/Extensions/EnvelopeAuthExtensions.cs @@ -11,7 +11,7 @@ namespace EnvelopeGenerator.API.Extensions; /// public static class EnvelopeAuthExtensions { - private static string GetRequiredClaim(this ClaimsPrincipal user, string claimType) + private static string GetRequiredClaimOfReceiver(this ClaimsPrincipal user, string claimType) { var value = user.FindFirstValue(claimType); if (value is not null) @@ -30,34 +30,34 @@ public static class EnvelopeAuthExtensions /// /// Gets the authenticated envelope UUID from the claims. /// - public static string GetAuthEnvelopeUuid(this ClaimsPrincipal user) => user.GetRequiredClaim(ClaimTypes.NameIdentifier); + public static string GetEnvelopeUuidOfReceiver(this ClaimsPrincipal user) => user.GetRequiredClaimOfReceiver(ClaimTypes.NameIdentifier); /// /// Gets the authenticated receiver signature from the claims. /// - public static string GetAuthReceiverSignature(this ClaimsPrincipal user) => user.GetRequiredClaim(ClaimTypes.Hash); + public static string GetReceiverSignatureOfReceiver(this ClaimsPrincipal user) => user.GetRequiredClaimOfReceiver(ClaimTypes.Hash); /// /// Gets the authenticated receiver display name from the claims. /// - public static string GetAuthReceiverName(this ClaimsPrincipal user) => user.GetRequiredClaim(ClaimTypes.Name); + public static string GetReceiverNameOfReceiver(this ClaimsPrincipal user) => user.GetRequiredClaimOfReceiver(ClaimTypes.Name); /// /// Gets the authenticated receiver email address from the claims. /// - public static string GetAuthReceiverMail(this ClaimsPrincipal user) => user.GetRequiredClaim(ClaimTypes.Email); + public static string GetReceiverMailOfReceiver(this ClaimsPrincipal user) => user.GetRequiredClaimOfReceiver(ClaimTypes.Email); /// /// Gets the authenticated envelope title from the claims. /// - public static string GetAuthEnvelopeTitle(this ClaimsPrincipal user) => user.GetRequiredClaim(EnvelopeClaimTypes.Title); + public static string GetEnvelopeTitleOfReceiver(this ClaimsPrincipal user) => user.GetRequiredClaimOfReceiver(EnvelopeClaimTypes.Title); /// /// Gets the authenticated envelope identifier from the claims. /// - public static int GetAuthEnvelopeId(this ClaimsPrincipal user) + public static int GetEnvelopeIdOfReceiver(this ClaimsPrincipal user) { - var envIdStr = user.GetRequiredClaim(EnvelopeClaimTypes.Id); + var envIdStr = user.GetRequiredClaimOfReceiver(EnvelopeClaimTypes.Id); if (!int.TryParse(envIdStr, out var envId)) { throw new InvalidOperationException($"Claim '{EnvelopeClaimTypes.Id}' is not a valid integer.");