From ad58d1f77c2039a62b225545fb795d3395046303 Mon Sep 17 00:00:00 2001 From: Patrick Barron Date: Wed, 22 Nov 2023 09:40:49 -0500 Subject: [PATCH] Use ExecuteDelete for removing API keys --- .../Security/AuthenticationManager.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs index b2dfe60a14..07ac27e3c2 100644 --- a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs +++ b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs @@ -58,19 +58,10 @@ namespace Jellyfin.Server.Implementations.Security var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false); await using (dbContext.ConfigureAwait(false)) { - var key = await dbContext.ApiKeys + await dbContext.ApiKeys .Where(apiKey => apiKey.AccessToken == accessToken) - .FirstOrDefaultAsync() + .ExecuteDeleteAsync() .ConfigureAwait(false); - - if (key is null) - { - return; - } - - dbContext.Remove(key); - - await dbContext.SaveChangesAsync().ConfigureAwait(false); } } }