diff options
| author | David <daullmer@gmail.com> | 2020-06-20 18:02:03 +0200 |
|---|---|---|
| committer | David <daullmer@gmail.com> | 2020-06-20 18:02:03 +0200 |
| commit | 1c78482b480034738516596248955e3e09756dd6 (patch) | |
| tree | 9f29040cabb37d86cbbece2f4f6b8c22d284432f /Emby.Server.Implementations/HttpServer/Security/AuthService.cs | |
| parent | beb3896d7fba09e038b45c784273dbea1e48013c (diff) | |
Use authorization code from api-migration to fix startup wizard
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/Security/AuthService.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/Security/AuthService.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs index 2e6ff65a6..318bc6a24 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs @@ -51,6 +51,22 @@ namespace Emby.Server.Implementations.HttpServer.Security return user; } + public AuthorizationInfo Authenticate(HttpRequest request) + { + var auth = _authorizationContext.GetAuthorizationInfo(request); + if (auth?.User == null) + { + return null; + } + + if (auth.User.HasPermission(PermissionKind.IsDisabled)) + { + throw new SecurityException("User account has been disabled."); + } + + return auth; + } + private User ValidateUser(IRequest request, IAuthenticationAttributes authAttribtues) { // This code is executed before the service |
