Refactor authorization policy naming to AuthPolicy

Renamed AuthorizationPolicies to AuthPolicy and updated all references to use the new naming convention for authorization policy constants. This improves consistency and clarity across the codebase.
This commit is contained in:
2026-02-03 16:01:28 +01:00
parent d99193979f
commit 1b95b9d7e0
4 changed files with 6 additions and 6 deletions

View File

@@ -34,7 +34,7 @@ public partial class AuthController(IOptions<AuthTokenKeys> authTokenKeyOptions)
/// <response code="401">Wenn es kein zugelassenes Cookie gibt, wird „nicht zugelassen“ zurückgegeben.</response>
[ProducesResponseType(typeof(string), StatusCodes.Status200OK, "text/javascript")]
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
[Authorize(Policy = AuthorizationPolicies.SenderOrReceiverFullyAuth)]
[Authorize(Policy = AuthPolicy.SenderOrReceiverFullyAuth)]
[HttpPost("logout")]
public async Task<IActionResult> Logout()
{
@@ -56,7 +56,7 @@ public partial class AuthController(IOptions<AuthTokenKeys> authTokenKeyOptions)
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
[HttpGet("check")]
[Authorize(Policy = AuthorizationPolicies.SenderOrReceiverFullyAuth)]
[Authorize(Policy = AuthPolicy.SenderOrReceiverFullyAuth)]
public IActionResult Check([FromQuery] string role) => User.IsInRole(role) ? Ok() : Unauthorized();
/// <summary>

View File

@@ -111,7 +111,7 @@ public class TfaRegistrationController : ControllerBase
/// <summary>
/// Logs out the envelope receiver from cookie authentication.
/// </summary>
[Authorize(Policy = AuthorizationPolicies.ReceiverFullyAuth)]
[Authorize(Policy = AuthPolicy.ReceiverFullyAuth)]
[HttpPost("auth/logout")]
public async Task<IActionResult> LogOutAsync()
{

View File

@@ -178,9 +178,9 @@ try
});
builder.Services.AddAuthorizationBuilder()
.AddPolicy(AuthorizationPolicies.SenderOrReceiverFullyAuth, policy =>
.AddPolicy(AuthPolicy.SenderOrReceiverFullyAuth, policy =>
policy.RequireRole(Role.Sender, Role.Receiver.FullyAuth))
.AddPolicy(AuthorizationPolicies.ReceiverFullyAuth, policy =>
.AddPolicy(AuthPolicy.ReceiverFullyAuth, policy =>
policy.RequireRole(Role.Receiver.FullyAuth));
// User manager

View File

@@ -1,6 +1,6 @@
namespace EnvelopeGenerator.Domain.Constants
{
public static class AuthorizationPolicies
public static class AuthPolicy
{
public const string SenderOrReceiverFullyAuth = "SenderOrReceiverFullyAuth";
public const string ReceiverFullyAuth = "ReceiverFullyAuth";