aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
diff options
context:
space:
mode:
authoradrez99 <59739805+adrez99@users.noreply.github.com>2022-10-11 18:15:28 +0200
committeradrez99 <adrez99@gmail.com>2022-10-11 18:18:21 +0200
commit3736e360e76fdc44d8069905ba76aec03e69473f (patch)
tree1626fd7da50abf0350ab1b644d6699bd39590dd6 /Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
parentb8afdd892af01fd99011a6dc3df65cfb762084d6 (diff)
parentd50c1b2d4bc0c85428671b288adef1b336da1156 (diff)
Merge branch 'jellyfin:master' into gzip
Diffstat (limited to 'Jellyfin.Api/Auth/BaseAuthorizationHandler.cs')
-rw-r--r--Jellyfin.Api/Auth/BaseAuthorizationHandler.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs b/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
index 13d3257df..92ee1dd59 100644
--- a/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
+++ b/Jellyfin.Api/Auth/BaseAuthorizationHandler.cs
@@ -1,4 +1,5 @@
using System.Security.Claims;
+using Jellyfin.Api.Extensions;
using Jellyfin.Api.Helpers;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Extensions;
@@ -51,21 +52,21 @@ namespace Jellyfin.Api.Auth
bool requiredDownloadPermission = false)
{
// ApiKey is currently global admin, always allow.
- var isApiKey = ClaimHelpers.GetIsApiKey(claimsPrincipal);
+ var isApiKey = claimsPrincipal.GetIsApiKey();
if (isApiKey)
{
return true;
}
// Ensure claim has userId.
- var userId = ClaimHelpers.GetUserId(claimsPrincipal);
- if (!userId.HasValue)
+ var userId = claimsPrincipal.GetUserId();
+ if (userId.Equals(default))
{
return false;
}
// Ensure userId links to a valid user.
- var user = _userManager.GetUserById(userId.Value);
+ var user = _userManager.GetUserById(userId);
if (user == null)
{
return false;