Refactor sender page and auth service logic
- Added project reference to `EnvelopeGenerator.Application` in the client project. - Updated imports and injected services in `EnvelopeSenderPage.razor`. - Improved null handling for `EnvelopeReceivers` and updated email display logic. - Replaced `CheckSenderAsync` with `CheckSenderAccessAsync` for authorization. - Refactored `GetStatusInfo` to use `EnvelopeStatus` enum directly. - Added `CheckSenderAccessAsync` and `LogoutSenderAsync` methods in `AuthService`. - Simplified `Logout` logic in `AuthController` to remove redundant checks.
This commit is contained in:
@@ -40,17 +40,11 @@ public partial class AuthController(IOptions<AuthTokenKeys> authTokenKeyOptions,
|
||||
/// <response code="401">Wenn es kein zugelassenes Cookie gibt, wird „nicht zugelassen“ zurückgegeben.</response>
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[Authorize(Policy = AuthPolicy.SenderOrReceiver)]
|
||||
[Authorize(Policy = AuthPolicy.Sender)]
|
||||
[HttpPost("logout")]
|
||||
public async Task<IActionResult> Logout()
|
||||
public IActionResult Logout()
|
||||
{
|
||||
if (await this.IsUserInPolicyAsync(AuthPolicy.Sender))
|
||||
Response.Cookies.Delete(authTokenKeys.Cookie);
|
||||
else if (await this.IsUserInPolicyAsync(AuthPolicy.ReceiverOrReceiverTFA))
|
||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
else
|
||||
return Unauthorized();
|
||||
|
||||
Response.Cookies.Delete(authTokenKeys.Cookie);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user