refactor(api): Aktualisierung von ControllerExtensions zur Nutzung von ClaimsPrincipal anstelle von ControllerBase

- Refactoring der Erweiterungsmethoden, sodass sie auf `ClaimsPrincipal` anstatt auf `ControllerBase` basieren.
- Alle Verweise und Verwendungen dieser Erweiterungsmethoden im gesamten Code aktualisiert.
- Dies verbessert die Flexibilität und entkoppelt das Abrufen von Benutzeransprüchen von den Controllern.
This commit is contained in:
Developer 02
2024-09-05 10:24:00 +02:00
parent e3fbf4fc77
commit 5b8d8b9e55
3 changed files with 13 additions and 13 deletions

View File

@@ -24,12 +24,12 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers
{
try
{
var username = this.GetUsername();
var username = User.GetUsername();
if (username is null)
{
_logger.LogError(@"Envelope Receiver dto cannot be sent because username claim is null. Potential authentication and authorization error. The value of other claims are [id: {id}], [username: {username}], [name: {name}], [prename: {prename}], [email: {email}].",
this.GetId(), this.GetUsername(), this.GetName(), this.GetPrename(), this.GetEmail());
User.GetId(), User.GetUsername(), User.GetName(), User.GetPrename(), User.GetEmail());
return StatusCode(StatusCodes.Status500InternalServerError);
}