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:
2026-06-28 21:39:33 +02:00
parent fe09c5c7ae
commit b56f906848
2 changed files with 2 additions and 3 deletions

View File

@@ -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

View File

@@ -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()