Implement jwks endpoint and add test for it.
This also let to some improvements/cleanups of the other tests and fixtures.
This commit is contained in:
parent
a80c133e2a
commit
ccb06b260c
24 changed files with 353 additions and 107 deletions
|
|
@ -8,4 +8,5 @@ public interface IRealmService
|
|||
Task<Realm?> FindBySlug(string slug, CancellationToken ct = default);
|
||||
|
||||
Task<Result<RealmCreateResponse>> Create(RealmCreateRequest request, CancellationToken ct = default);
|
||||
Task LoadActiveKeys(Realm realm);
|
||||
}
|
||||
|
|
@ -15,7 +15,8 @@ public class RealmService(
|
|||
{
|
||||
public async Task<Realm?> FindBySlug(string slug, CancellationToken ct = default)
|
||||
{
|
||||
return await db.Realms.SingleOrDefaultAsync(r => r.Slug == slug, ct);
|
||||
return await db.Realms
|
||||
.SingleOrDefaultAsync(r => r.Slug == slug, ct);
|
||||
}
|
||||
|
||||
public async Task<Result<RealmCreateResponse>> Create(RealmCreateRequest request, CancellationToken ct = default)
|
||||
|
|
@ -35,6 +36,15 @@ public class RealmService(
|
|||
realm.Id, realm.Slug, realm.Name);
|
||||
}
|
||||
|
||||
public async Task LoadActiveKeys(Realm realm)
|
||||
{
|
||||
await db.Entry(realm).Collection(r => r.Keys)
|
||||
.Query()
|
||||
.Where(k => k.DeactivatedAt == null)
|
||||
.LoadAsync();
|
||||
|
||||
}
|
||||
|
||||
private Key CreateKey()
|
||||
{
|
||||
using RSA rsa = RSA.Create(2048);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue