diff options
| author | BaronGreenback <jimcartlidge@yahoo.co.uk> | 2020-06-24 14:16:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-24 14:16:02 +0100 |
| commit | 2486e480976d836e9b65c9bd986a0661c3c0229b (patch) | |
| tree | cb406ee0172bd4620cfae930f2e798a0e54653e7 /Jellyfin.Api/Auth/CustomAuthenticationHandler.cs | |
| parent | b5586e64f5d815f4449930dc53a61a676d0e2df4 (diff) | |
| parent | 92091f13d3da982e6fd4465101b8e58220c457e4 (diff) | |
Merge pull request #30 from jellyfin/master
Updating master
Diffstat (limited to 'Jellyfin.Api/Auth/CustomAuthenticationHandler.cs')
| -rw-r--r-- | Jellyfin.Api/Auth/CustomAuthenticationHandler.cs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Jellyfin.Api/Auth/CustomAuthenticationHandler.cs b/Jellyfin.Api/Auth/CustomAuthenticationHandler.cs index 767ba9fd4..f86f75b1c 100644 --- a/Jellyfin.Api/Auth/CustomAuthenticationHandler.cs +++ b/Jellyfin.Api/Auth/CustomAuthenticationHandler.cs @@ -39,21 +39,18 @@ namespace Jellyfin.Api.Auth /// <inheritdoc /> protected override Task<AuthenticateResult> HandleAuthenticateAsync() { - var authenticatedAttribute = new AuthenticatedAttribute(); try { - var user = _authService.Authenticate(Request, authenticatedAttribute); - if (user == null) + var authorizationInfo = _authService.Authenticate(Request); + if (authorizationInfo == null) { return Task.FromResult(AuthenticateResult.Fail("Invalid user")); } var claims = new[] { - new Claim(ClaimTypes.Name, user.Username), - new Claim( - ClaimTypes.Role, - value: user.HasPermission(PermissionKind.IsAdministrator) ? UserRoles.Administrator : UserRoles.User) + new Claim(ClaimTypes.Name, authorizationInfo.User.Username), + new Claim(ClaimTypes.Role, authorizationInfo.User.HasPermission(PermissionKind.IsAdministrator) ? UserRoles.Administrator : UserRoles.User) }; var identity = new ClaimsIdentity(claims, Scheme.Name); var principal = new ClaimsPrincipal(identity); |
