Started implementing client and api server auth and the refresh endpoint

This commit is contained in:
Masu Baumgartner
2024-10-19 16:37:37 +02:00
parent 6be3b8338d
commit 8883b521e9
7 changed files with 94 additions and 9 deletions

View File

@@ -135,7 +135,7 @@ if (config.Authentication.UseLocalOAuth2Service)
builder.Services.AddTokenAuthentication(configuration =>
{
configuration.AccessSecret = config.Authentication.AccessSecret;
configuration.AccessSecret = config.Authentication.MlAccessSecret;
configuration.DataLoader = async (data, provider, context) =>
{
if (!data.TryGetValue("userId", out var userIdStr) || !int.TryParse(userIdStr, out var userId))
@@ -148,7 +148,7 @@ builder.Services.AddTokenAuthentication(configuration =>
return false;
// OAuth2 - Check external
if (DateTime.UtcNow > user.RefreshTimestamp)
if (false && DateTime.UtcNow > user.RefreshTimestamp)
{
var tokenConsumer = new TokenConsumer(user.AccessToken, user.RefreshToken, user.RefreshTimestamp,
async refreshToken =>
@@ -170,7 +170,7 @@ builder.Services.AddTokenAuthentication(configuration =>
};
});
await tokenConsumer.GetAccessToken();
//await tokenConsumer.GetAccessToken();
//TODO: API CALL (modular)
}