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:
@@ -24,7 +24,7 @@ public class DocumentController(IMediator mediator, ILogger<DocumentController>
|
||||
/// <param name="query">Encoded envelope key.</param>
|
||||
/// <param name="cancel">Cancellation token.</param>
|
||||
[HttpGet]
|
||||
[Authorize(Roles = $"{Role.Sender},{Role.Receiver.FullyAuth}")]
|
||||
[Authorize(Policy = AuthPolicy.SenderOrReceiver)]
|
||||
public async Task<IActionResult> GetDocument(CancellationToken cancel, [FromQuery] ReadDocumentQuery? query = null)
|
||||
{
|
||||
// Sender: expects query with envelope key
|
||||
|
||||
Reference in New Issue
Block a user