mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authAttribtues.AllowLocalOnly && request.IsLocal)
|
if (authAttribtues.AllowLocalOnly && request.IsLocal)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (authAttribtues.IgnoreLegacyAuth)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,13 +37,20 @@ namespace Jellyfin.Api.Auth
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||||
{
|
{
|
||||||
var authenticatedAttribute = new AuthenticatedAttribute();
|
var authenticatedAttribute = new AuthenticatedAttribute
|
||||||
|
{
|
||||||
|
IgnoreLegacyAuth = true
|
||||||
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var user = _authService.Authenticate(Request, authenticatedAttribute);
|
var user = _authService.Authenticate(Request, authenticatedAttribute);
|
||||||
if (user == null)
|
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[]
|
var claims = new[]
|
||||||
|
@ -52,6 +52,8 @@ namespace MediaBrowser.Controller.Net
|
|||||||
return (Roles ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
return (Roles ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IgnoreLegacyAuth { get; set; }
|
||||||
|
|
||||||
public bool AllowLocalOnly { get; set; }
|
public bool AllowLocalOnly { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,5 +65,7 @@ namespace MediaBrowser.Controller.Net
|
|||||||
bool AllowLocalOnly { get; }
|
bool AllowLocalOnly { get; }
|
||||||
|
|
||||||
string[] GetRoles();
|
string[] GetRoles();
|
||||||
|
|
||||||
|
bool IgnoreLegacyAuth { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user