Move SecurityException

pull/4330/head
crobibero 4 years ago
parent 4b6889615b
commit d5c226b1c3

@ -19,6 +19,11 @@ namespace Emby.Server.Implementations.HttpServer.Security
public AuthorizationInfo Authenticate(HttpRequest request) public AuthorizationInfo Authenticate(HttpRequest request)
{ {
var auth = _authorizationContext.GetAuthorizationInfo(request); var auth = _authorizationContext.GetAuthorizationInfo(request);
if (auth == null)
{
throw new SecurityException("Unauthenticated request.");
}
if (auth.User?.HasPermission(PermissionKind.IsDisabled) ?? false) if (auth.User?.HasPermission(PermissionKind.IsDisabled) ?? false)
{ {
throw new SecurityException("User account has been disabled."); throw new SecurityException("User account has been disabled.");

@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
if (string.IsNullOrWhiteSpace(token)) if (string.IsNullOrWhiteSpace(token))
{ {
// Request doesn't contain a token. // Request doesn't contain a token.
throw new SecurityException("Unauthorized."); return (null, null);
} }
var result = _authRepo.Get(new AuthenticationInfoQuery var result = _authRepo.Get(new AuthenticationInfoQuery

Loading…
Cancel
Save