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 /Emby.Server.Implementations/HttpServer/Security/AuthService.cs | |
| parent | b5586e64f5d815f4449930dc53a61a676d0e2df4 (diff) | |
| parent | 92091f13d3da982e6fd4465101b8e58220c457e4 (diff) | |
Merge pull request #30 from jellyfin/master
Updating master
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 |
