[FA-17] Update auth
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using FictionArchive.Common.Extensions;
|
||||
using FictionArchive.Service.Shared;
|
||||
using FictionArchive.Service.Shared.Extensions;
|
||||
using FictionArchive.Service.Shared.Services.EventBus.Implementations;
|
||||
@@ -15,7 +16,8 @@ public class Program
|
||||
var isSchemaExport = SchemaExportDetector.IsSchemaExportMode(args);
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.AddLocalAppsettings();
|
||||
|
||||
#region Event Bus
|
||||
|
||||
if (!isSchemaExport)
|
||||
@@ -31,7 +33,8 @@ public class Program
|
||||
|
||||
#region GraphQL
|
||||
|
||||
builder.Services.AddDefaultGraphQl<Query, Mutation>();
|
||||
builder.Services.AddDefaultGraphQl<Query, Mutation>()
|
||||
.AddAuthorization();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -41,7 +44,11 @@ public class Program
|
||||
builder.Services.AddTransient<UserManagementService>();
|
||||
|
||||
builder.Services.AddHealthChecks();
|
||||
|
||||
|
||||
// Authentication & Authorization
|
||||
builder.Services.AddOidcAuthentication(builder.Configuration);
|
||||
builder.Services.AddFictionArchiveAuthorization();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Update database (skip in schema export mode)
|
||||
@@ -52,8 +59,11 @@ public class Program
|
||||
dbContext.UpdateDatabase();
|
||||
}
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapGraphQL();
|
||||
|
||||
|
||||
app.MapHealthChecks("/healthz");
|
||||
|
||||
app.RunWithGraphQLCommands(args);
|
||||
|
||||
Reference in New Issue
Block a user