refactor(Controllers): FullyAuth-Rollenbedingung für jedes bestehende Auth-Attribut hinzugefügt, um die Autorisierung in Stufen aufzuteilen.

This commit is contained in:
Developer 02
2025-02-07 10:53:17 +01:00
parent 82d8521a25
commit 33fcb5b70e
4 changed files with 13 additions and 12 deletions

View File

@@ -19,7 +19,6 @@ using Ganss.Xss;
using Newtonsoft.Json;
using EnvelopeGenerator.Application.DTOs;
using DigitalData.Core.Client;
using EnvelopeGenerator.Application.Extensions;
namespace EnvelopeGenerator.Web.Controllers;
@@ -321,7 +320,8 @@ public class HomeController : ViewControllerBase
new(ClaimTypes.Name, er.Name ?? string.Empty),
new(ClaimTypes.Email, er.Receiver.EmailAddress),
new(EnvelopeClaimTypes.Title, er.Envelope.Title),
new(EnvelopeClaimTypes.Id, er.Envelope.Id.ToString())
new(EnvelopeClaimTypes.Id, er.Envelope.Id.ToString()),
new(ClaimTypes.Role, ReceiverRole.FullyAuth)
};
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
@@ -348,7 +348,7 @@ public class HomeController : ViewControllerBase
}
}
[Authorize]
[Authorize(Roles = ReceiverRole.FullyAuth)]
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Success")]
public async Task<IActionResult> EnvelopeSigned(string envelopeReceiverId)
{
@@ -383,7 +383,7 @@ public class HomeController : ViewControllerBase
}
}
[Authorize]
[Authorize(Roles = ReceiverRole.FullyAuth)]
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Rejected")]
public async Task<IActionResult> EnvelopeRejected(string envelopeReceiverId)
{
@@ -489,7 +489,7 @@ public class HomeController : ViewControllerBase
}
}
[Authorize]
[Authorize(Roles = ReceiverRole.FullyAuth)]
[HttpGet("IsAuthenticated")]
public IActionResult IsAuthenticated()
{