diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2020-11-21 17:20:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-21 17:20:31 -0500 |
| commit | bf54b5579c15bdf8bb6e3dd6934ea23c45a62573 (patch) | |
| tree | 1b2df4bdf89a70f578b72240969416034afc33db /Emby.Server.Implementations/HttpServer/Security/AuthService.cs | |
| parent | 4a81ee43dc7aed94012c312a8262a1426be9b6d9 (diff) | |
| parent | b707d8e09d776a1dd1f0cdd6cf13cd1f3e638028 (diff) | |
Merge branch 'master' into defer_image_fetching
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."); } |
