Explorar o código

Move SecurityException

crobibero %!s(int64=4) %!d(string=hai) anos
pai
achega
d5c226b1c3

+ 5 - 0
Emby.Server.Implementations/HttpServer/Security/AuthService.cs

@@ -19,6 +19,11 @@ namespace Emby.Server.Implementations.HttpServer.Security
         public AuthorizationInfo Authenticate(HttpRequest request)
         {
             var auth = _authorizationContext.GetAuthorizationInfo(request);
+            if (auth == null)
+            {
+                throw new SecurityException("Unauthenticated request.");
+            }
+
             if (auth.User?.HasPermission(PermissionKind.IsDisabled) ?? false)
             {
                 throw new SecurityException("User account has been disabled.");

+ 1 - 1
Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs

@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
             if (string.IsNullOrWhiteSpace(token))
             {
                 // Request doesn't contain a token.
-                throw new SecurityException("Unauthorized.");
+                return (null, null);
             }
 
             var result = _authRepo.Get(new AuthenticationInfoQuery