Fail closed on malformed local auth

This commit is contained in:
2026-04-11 16:29:53 +02:00
parent 6a223a4b70
commit 09e96ce381
6 changed files with 90 additions and 19 deletions
+1 -10
View File
@@ -16,14 +16,5 @@ public sealed class CurrentUserService : ICurrentUserService
_http = http;
}
public string? UserId
{
get
{
var u = _http.HttpContext?.User;
if (u is null) return null;
if (u.Identity?.IsAuthenticated != true) return null;
return u.FindFirstValue(ClaimTypes.NameIdentifier) ?? u.FindFirstValue("sub");
}
}
public string? UserId => LocalAuthIdentity.GetRequiredUserId(_http.HttpContext?.User);
}