mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-22 00:35:26 +03:00
Return NoResult only when request doesn't have a token.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user