Refactor to use named authorization policies in controllers
Replaced direct role-based [Authorize] attributes with named authorization policies (e.g., AuthPolicy.Receiver, AuthPolicy.SenderOrReceiver) in AnnotationController, DocumentController, and ReadOnlyController. Added and registered new policies in Program.cs and updated AuthPolicy constants. This centralizes and simplifies authorization management.
This commit is contained in:
@@ -180,8 +180,12 @@ try
|
||||
builder.Services.AddAuthorizationBuilder()
|
||||
.AddPolicy(AuthPolicy.SenderOrReceiver, policy =>
|
||||
policy.RequireRole(Role.Sender, Role.Receiver.FullyAuth))
|
||||
.AddPolicy(AuthPolicy.Sender, policy =>
|
||||
policy.RequireRole(Role.Sender))
|
||||
.AddPolicy(AuthPolicy.Receiver, policy =>
|
||||
policy.RequireRole(Role.Receiver.FullyAuth));
|
||||
policy.RequireRole(Role.Receiver.FullyAuth))
|
||||
.AddPolicy(AuthPolicy.ReceiverTFA, policy =>
|
||||
policy.RequireRole(Role.Receiver.PreAuth));
|
||||
|
||||
// User manager
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
|
||||
Reference in New Issue
Block a user