From 1c78482b480034738516596248955e3e09756dd6 Mon Sep 17 00:00:00 2001 From: David Date: Sat, 20 Jun 2020 18:02:03 +0200 Subject: Use authorization code from api-migration to fix startup wizard --- .../HttpServer/Security/AuthService.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Emby.Server.Implementations/HttpServer/Security/AuthService.cs') 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 -- cgit v1.2.3