diff options
| author | crobibero <cody@robibe.ro> | 2020-11-09 14:57:02 -0700 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-11-09 14:57:02 -0700 |
| commit | 6748ba287d8cd9054072ce1ffc51c7aa8690e108 (patch) | |
| tree | 5b859fa356ef2f6abd5fb281ff5655ccf5fd3ebf /Emby.Server.Implementations/HttpServer/Security/AuthService.cs | |
| parent | f8e6edbfeb8c437c2ed0a9c9b44bed0fc105b2c2 (diff) | |
| parent | 296e534f670df9069e8cb50683a964ea2a5cdc37 (diff) | |
Merge remote-tracking branch 'upstream/master' into query-fields
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/Security/AuthService.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/Security/AuthService.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs index 68d981ad1..df7a034e8 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs @@ -1,6 +1,7 @@ #pragma warning disable CS1591 using Jellyfin.Data.Enums; +using MediaBrowser.Controller.Authentication; using MediaBrowser.Controller.Net; using Microsoft.AspNetCore.Http; @@ -19,12 +20,12 @@ namespace Emby.Server.Implementations.HttpServer.Security public AuthorizationInfo Authenticate(HttpRequest request) { var auth = _authorizationContext.GetAuthorizationInfo(request); - if (auth?.User == null) + if (!auth.IsAuthenticated) { - return null; + throw new AuthenticationException("Invalid token."); } - if (auth.User.HasPermission(PermissionKind.IsDisabled)) + if (auth.User?.HasPermission(PermissionKind.IsDisabled) ?? false) { throw new SecurityException("User account has been disabled."); } |
