mirror of
https://github.com/bitwarden/server.git
synced 2025-06-20 02:48:03 -05:00
Merge branch 'km/db-signing-keys' into km/signing-api-changes
This commit is contained in:
commit
d5ee08b52a
@ -11,13 +11,13 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.KeyManagement.Repositories;
|
||||
|
||||
public class UserSignatureKeyPairRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : Repository<Core.KeyManagement.Entities.UserSignatureKeyPair, Models.UserSignatureKeyPair, Guid>(serviceScopeFactory, mapper, context => context.UserSignatureKeyPair), IUserSignatureKeyPairRepository
|
||||
public class UserSignatureKeyPairRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : Repository<Core.KeyManagement.Entities.UserSignatureKeyPair, Models.UserSignatureKeyPair, Guid>(serviceScopeFactory, mapper, context => context.UserSignatureKeyPairs), IUserSignatureKeyPairRepository
|
||||
{
|
||||
public async Task<SignatureKeyPairData?> GetByUserIdAsync(Guid userId)
|
||||
{
|
||||
await using var scope = ServiceScopeFactory.CreateAsyncScope();
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
var signingKeys = await dbContext.UserSignatureKeyPair.FindAsync(userId);
|
||||
var signingKeys = await dbContext.UserSignatureKeyPairs.FindAsync(userId);
|
||||
if (signingKeys == null)
|
||||
{
|
||||
return null;
|
||||
@ -42,7 +42,7 @@ public class UserSignatureKeyPairRepository(IServiceScopeFactory serviceScopeFac
|
||||
CreationDate = DateTime.UtcNow,
|
||||
RevisionDate = DateTime.UtcNow,
|
||||
};
|
||||
await dbContext.UserSignatureKeyPair.AddAsync(entity);
|
||||
await dbContext.UserSignatureKeyPairs.AddAsync(entity);
|
||||
await dbContext.SaveChangesAsync();
|
||||
};
|
||||
}
|
||||
@ -53,7 +53,7 @@ public class UserSignatureKeyPairRepository(IServiceScopeFactory serviceScopeFac
|
||||
{
|
||||
await using var scope = ServiceScopeFactory.CreateAsyncScope();
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
var entity = await dbContext.UserSignatureKeyPair.FirstOrDefaultAsync(x => x.UserId == grantorId);
|
||||
var entity = await dbContext.UserSignatureKeyPairs.FirstOrDefaultAsync(x => x.UserId == grantorId);
|
||||
if (entity != null)
|
||||
{
|
||||
entity.SignatureAlgorithm = signingKeys.SignatureAlgorithm;
|
||||
|
@ -71,7 +71,7 @@ public class DatabaseContext : DbContext
|
||||
public DbSet<TaxRate> TaxRates { get; set; }
|
||||
public DbSet<Transaction> Transactions { get; set; }
|
||||
public DbSet<User> Users { get; set; }
|
||||
public DbSet<UserSignatureKeyPair> UserSignatureKeyPair { get; set; }
|
||||
public DbSet<UserSignatureKeyPair> UserSignatureKeyPairs { get; set; }
|
||||
public DbSet<AuthRequest> AuthRequests { get; set; }
|
||||
public DbSet<OrganizationDomain> OrganizationDomains { get; set; }
|
||||
public DbSet<WebAuthnCredential> WebAuthnCredentials { get; set; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user