Refactor receiver roles: rename FullyAuth/PreAuth for clarity

Renamed receiver roles FullyAuth → Receiver.Full and PreAuth → Receiver.TFA across the codebase for improved clarity and consistency. Updated all usages, [Authorize] attributes, role checks, authentication logic, and authorization policies to use the new role names. Marked old constants as obsolete and pointed them to the new values. This change enhances code readability and groups receiver roles under the Receiver static class.
This commit is contained in:
2026-02-06 10:49:28 +01:00
parent 0d2425c9cf
commit ebed51b46a
9 changed files with 26 additions and 26 deletions

View File

@@ -40,7 +40,7 @@ public partial class AuthController(IOptions<AuthTokenKeys> authTokenKeyOptions)
{
if (User.IsInRole(Role.Sender))
Response.Cookies.Delete(authTokenKeys.Cookie);
else if (User.IsInRole(Role.Receiver.FullyAuth))
else if (User.IsInRole(Role.Receiver.Full))
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
else
return Unauthorized();

View File

@@ -40,7 +40,7 @@ public class DocumentController(IMediator mediator, ILogger<DocumentController>
}
// Receiver: resolve envelope id from claims
if (User.IsInRole(Role.Receiver.FullyAuth))
if (User.IsInRole(Role.Receiver.Full))
{
if (query is not null)
return BadRequest("Query parameters are not allowed for receiver role.");

View File

@@ -179,13 +179,13 @@ try
builder.Services.AddAuthorizationBuilder()
.AddPolicy(AuthPolicy.SenderOrReceiver, policy =>
policy.RequireRole(Role.Sender, Role.Receiver.FullyAuth))
policy.RequireRole(Role.Sender, Role.Receiver.Full))
.AddPolicy(AuthPolicy.Sender, policy =>
policy.RequireRole(Role.Sender))
.AddPolicy(AuthPolicy.Receiver, policy =>
policy.RequireRole(Role.Receiver.FullyAuth))
policy.RequireRole(Role.Receiver.Full))
.AddPolicy(AuthPolicy.ReceiverTFA, policy =>
policy.RequireRole(Role.Receiver.PreAuth));
policy.RequireRole(Role.Receiver.TFA));
// User manager
#pragma warning disable CS0618 // Type or member is obsolete