diff options
| author | crobibero <cody@robibe.ro> | 2020-12-01 14:47:42 -0700 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-12-01 14:47:42 -0700 |
| commit | cd459c51f3d8a6a46a802759df1620ec43e5d2ae (patch) | |
| tree | d43a8609b771876845f2a86daffd2ff11db1fa1e /Emby.Server.Implementations/HttpServer/Security/AuthService.cs | |
| parent | 38b3b4f8672373c8e1ac2e509d759fe07d179146 (diff) | |
Return NoResult only when request doesn't have a token.
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/Security/AuthService.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/Security/AuthService.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs index df7a034e8..4a0fc8239 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs @@ -1,5 +1,6 @@ #pragma warning disable CS1591 +using System; using Jellyfin.Data.Enums; using MediaBrowser.Controller.Authentication; using MediaBrowser.Controller.Net; @@ -20,9 +21,15 @@ namespace Emby.Server.Implementations.HttpServer.Security public AuthorizationInfo Authenticate(HttpRequest request) { var auth = _authorizationContext.GetAuthorizationInfo(request); + + if (!auth.HasToken) + { + throw new AuthenticationException("Request does not contain a token."); + } + if (!auth.IsAuthenticated) { - throw new AuthenticationException("Invalid token."); + throw new SecurityException("Invalid token."); } if (auth.User?.HasPermission(PermissionKind.IsDisabled) ?? false) |
