mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 02:18:54 -07:00
Move SecurityException
This commit is contained in:
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…
Reference in New Issue
Block a user