Refine authorization and rendering mechanisms
Updated `EnvelopeSenderPage.razor` to replace the `[Authorize]` attribute with the `@rendermode InteractiveWebAssembly` directive, indicating a shift in how authorization or rendering is handled. Modified the `Check` method in `AuthController.cs` to specify `AuthenticationSchemes = AuthScheme.Sender` in the `[Authorize]` attribute, enforcing a more specific authentication scheme for this endpoint.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
@page "/sender"
|
||||
@attribute [Microsoft.AspNetCore.Authorization.Authorize(Policy = "Sender")]
|
||||
|
||||
@rendermode InteractiveWebAssembly
|
||||
@using System.Text.Json
|
||||
@using EnvelopeGenerator.Domain.Constants
|
||||
@using EnvelopeGenerator.Server.Client.Models
|
||||
|
||||
@@ -63,7 +63,7 @@ public partial class AuthController(IOptions<AuthTokenKeys> authTokenKeyOptions,
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[HttpGet("check")]
|
||||
[Authorize]
|
||||
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||
public IActionResult Check(string? role = null)
|
||||
=> role is not null && !User.IsInRole(role)
|
||||
? Unauthorized()
|
||||
|
||||
Reference in New Issue
Block a user