Remove log spam when using legacy api
This commit is contained in:
parent
b944b8f8c5
commit
e30a85025f
|
@ -146,11 +146,17 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (authAttribtues.AllowLocalOnly && request.IsLocal)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (authAttribtues.IgnoreLegacyAuth)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,13 +37,20 @@ namespace Jellyfin.Api.Auth
|
|||
/// <inheritdoc />
|
||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
var authenticatedAttribute = new AuthenticatedAttribute();
|
||||
var authenticatedAttribute = new AuthenticatedAttribute
|
||||
{
|
||||
IgnoreLegacyAuth = true
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var user = _authService.Authenticate(Request, authenticatedAttribute);
|
||||
if (user == null)
|
||||
{
|
||||
return Task.FromResult(AuthenticateResult.Fail("Invalid user"));
|
||||
return Task.FromResult(AuthenticateResult.NoResult());
|
||||
// TODO return when legacy API is removed.
|
||||
// Don't spam the log with "Invalid User"
|
||||
// return Task.FromResult(AuthenticateResult.Fail("Invalid user"));
|
||||
}
|
||||
|
||||
var claims = new[]
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace MediaBrowser.Controller.Net
|
|||
return (Roles ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
public bool IgnoreLegacyAuth { get; set; }
|
||||
|
||||
public bool AllowLocalOnly { get; set; }
|
||||
}
|
||||
|
||||
|
@ -63,5 +65,7 @@ namespace MediaBrowser.Controller.Net
|
|||
bool AllowLocalOnly { get; }
|
||||
|
||||
string[] GetRoles();
|
||||
|
||||
bool IgnoreLegacyAuth { get; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user