metrics service

fixes to auth info
This commit is contained in:
2025-07-05 23:55:40 -04:00
parent 5a34860fca
commit cc64675c9c
8 changed files with 104 additions and 15 deletions

View File

@@ -0,0 +1,26 @@
using AobaServer.Models;
using MongoDB.Driver;
namespace AobaServer.Services;
public class AuthConfigService(IMongoDatabase db)
{
public IMongoCollection<AuthInfo> _authInfo = db.GetCollection<AuthInfo>("auth_config");
public async Task<AuthInfo> GetAuthInfoAsync(string issuer, string audience)
{
var info = await _authInfo.Find("{}").FirstOrDefaultAsync();
if(info != null)
return info;
info = AuthInfo.Create(issuer, audience);
await _authInfo.InsertOneAsync(info);
return info;
}
public Task<AuthInfo> GetDefaultAuthInfoAsync()
{
return GetAuthInfoAsync("aobaV2", "aoba");
}
}