Started testing oauth2 handler from mooncore

This commit is contained in:
Masu Baumgartner
2024-11-05 22:46:26 +01:00
parent 69e5e1c75b
commit 288b0c8d97
11 changed files with 337 additions and 45 deletions

View File

@@ -9,6 +9,7 @@ using Moonlight.ApiServer;
using Moonlight.ApiServer.Configuration;
using Moonlight.ApiServer.Helpers;
using Moonlight.ApiServer.Http.Middleware;
using Moonlight.ApiServer.Implementations;
using Moonlight.ApiServer.Interfaces.Auth;
using Moonlight.ApiServer.Interfaces.OAuth2;
using Moonlight.ApiServer.Interfaces.Startup;
@@ -112,7 +113,6 @@ foreach (var startupInterface in appStartupInterfaces)
builder.Services.AddControllers();
builder.Services.AddSingleton(config);
builder.Services.AutoAddServices<Program>();
builder.Services.AddSingleton<TokenHelper>();
builder.Services.AddHttpClient();
await Startup.ConfigureTokenAuthentication(builder, config);
@@ -127,6 +127,8 @@ builder.Services.AddPlugins(configuration =>
configuration.AddAssembly(Assembly.GetEntryAssembly()!);
});
builder.Services.AddSingleton<MoonCore.Extended.Interfaces.IOAuth2Provider>(new TestyOuth2Provider());
var app = builder.Build();
await Startup.PrepareDatabase(app);
@@ -145,6 +147,7 @@ app.UseRouting();
app.UseMiddleware<ApiErrorMiddleware>();
await Startup.UseTokenAuthentication(app);
await Startup.UseOAuth2(app);
// Call interfaces
foreach (var startupInterface in appStartupInterfaces)