Re-add support for API keys

This commit is contained in:
Patrick Barron
2021-06-18 18:26:58 -04:00
parent 0292936c65
commit 336ba2879f
6 changed files with 22 additions and 10 deletions

View File

@@ -187,6 +187,19 @@ namespace Jellyfin.Server.Implementations.Security
await dbContext.SaveChangesAsync().ConfigureAwait(false);
}
}
else
{
var key = await dbContext.ApiKeys.FirstOrDefaultAsync(apiKey => apiKey.AccessToken == token).ConfigureAwait(false);
if (key != null)
{
authInfo.IsAuthenticated = true;
authInfo.Client = key.Name;
authInfo.Token = key.AccessToken;
authInfo.DeviceId = string.Empty;
authInfo.Device = string.Empty;
authInfo.Version = string.Empty;
}
}
return authInfo;
}