diff --git a/src/Tgstation.Server.Host/Security/AuthorizationContextHubFilter.cs b/src/Tgstation.Server.Host/Security/AuthorizationContextHubFilter.cs index a64f3d4cdb..3eefac4f2e 100644 --- a/src/Tgstation.Server.Host/Security/AuthorizationContextHubFilter.cs +++ b/src/Tgstation.Server.Host/Security/AuthorizationContextHubFilter.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; -#nullable disable +using Tgstation.Server.Host.Models; namespace Tgstation.Server.Host.Security { @@ -46,7 +46,7 @@ namespace Tgstation.Server.Host.Security } /// - public async ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) + public async ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) { ArgumentNullException.ThrowIfNull(invocationContext); if (ValidateAuthenticationContext(invocationContext.Hub)) @@ -64,7 +64,7 @@ namespace Tgstation.Server.Host.Security { if (!authenticationContext.Valid) logger.LogTrace("The token for connection {connectionId} is no longer authenticated! Aborting...", hub.Context.ConnectionId); - else if (!authenticationContext.User.Enabled.Value) + else if (!authenticationContext.User.Require(x => x.Enabled)) logger.LogTrace("The token for connection {connectionId} is no longer authorized! Aborting...", hub.Context.ConnectionId); else return true; @@ -75,8 +75,8 @@ namespace Tgstation.Server.Host.Security prop => prop.PropertyType.IsConstructedGenericType && prop.Name == nameof(hub.Clients)); var clients = typedClientsProperty.GetValue(hub); - var callerProperty = clients.GetType().GetProperty(nameof(hub.Clients.Caller)); - var caller = callerProperty.GetValue(clients); + var callerProperty = clients!.GetType().GetProperty(nameof(hub.Clients.Caller)); + var caller = callerProperty!.GetValue(clients); hub.Context.Abort(); return false;