aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-10-14 17:58:33 -0600
committercrobibero <cody@robibe.ro>2020-10-14 17:58:33 -0600
commit39924f99927ae85b85095cfe9c2d7fb4ece7e75a (patch)
treeb6727c2049d711d4c720c9208db4a02bc758e8bd /Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
parent8ffa14e6d3436cd6533bf43241c356f803b06845 (diff)
Allow apikey to authenticate as admin
Diffstat (limited to 'Jellyfin.Api/Auth/BaseAuthorizationHandler.cs')
-rw-r--r--Jellyfin.Api/Auth/BaseAuthorizationHandler.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs b/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
index d732b6bc6..c4567d058 100644
--- a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
+++ b/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
@@ -1,4 +1,5 @@
-using System.Security.Claims;
+using System;
+using System.Security.Claims;
using Jellyfin.Api.Helpers;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Extensions;
@@ -57,6 +58,12 @@ namespace Jellyfin.Api.Auth
return false;
}
+ // UserId of Guid.Empty means token is an apikey.
+ if (userId.Equals(Guid.Empty))
+ {
+ return true;
+ }
+
// Ensure userId links to a valid user.
var user = _userManager.GetUserById(userId.Value);
if (user == null)