some changes to auth

This commit is contained in:
rootdarkarchon
2022-12-29 20:14:47 +01:00
parent 3634cccd1e
commit cbe361208c
3 changed files with 30 additions and 18 deletions

View File

@@ -131,8 +131,6 @@ public partial class MareHub : Hub<IMareHub>, IMareHub
if (!string.IsNullOrEmpty(userCharaIdent))
{
_mareMetrics.DecGauge(MetricsAPI.GaugeAuthorizedConnections);
_logger.LogCallInfo();
_clientIdentService.MarkUserOffline(AuthenticatedUserId);

View File

@@ -23,9 +23,8 @@ public class UserRequirementHandler : AuthorizationHandler<UserRequirement, HubI
protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, UserRequirement requirement, HubInvocationContext resource)
{
var uid = context.User.Claims.SingleOrDefault(g => string.Equals(g.Type, ClaimTypes.NameIdentifier, StringComparison.Ordinal))?.Value;
var auth = context.User.Claims.SingleOrDefault(g => string.Equals(g.Type, ClaimTypes.Authentication, StringComparison.Ordinal))?.Value;
if (uid == null || auth == null) context.Fail();
if (uid == null) context.Fail();
if ((requirement.Requirements & UserRequirements.Identified) is UserRequirements.Identified)
{