Tests voor client api and service

This commit is contained in:
eelke 2026-02-22 09:27:48 +01:00
parent cd2ec646fd
commit 3d73a9914c
12 changed files with 267 additions and 30 deletions

View file

@ -34,14 +34,20 @@ public class ClientService(
return client;
}
public async Task<Client?> GetByClientId(string clientId, CancellationToken ct = default)
public async Task<Client?> GetByClientId(
Guid realmId,
string clientId,
CancellationToken ct = default)
{
return await db.Clients.FirstOrDefaultAsync(c => c.ClientId == clientId, ct);
return await db.Clients.FirstOrDefaultAsync(c => c.ClientId == clientId && c.RealmId == realmId, ct);
}
public async Task<Client?> FindById(int id, CancellationToken ct = default)
public async Task<Client?> FindById(
Guid realmId,
int id,
CancellationToken ct = default)
{
return await db.Clients.FirstOrDefaultAsync(c => c.Id == id, ct);
return await db.Clients.FirstOrDefaultAsync(c => c.Id == id && c.RealmId == realmId, ct);
}
private ClientSecret CreateSecret()