WIP: Add Keycloak jwt bearer
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using PresentPortal.Shared;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add service defaults & Aspire client integrations.
|
||||
@@ -9,6 +11,14 @@ builder.Services.AddProblemDetails();
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
builder.Services.AddOpenApi();
|
||||
|
||||
builder.Services.AddAuthentication()
|
||||
.AddKeycloakJwtBearer(ServiceNames.Keycloak, "TODO", options =>
|
||||
{
|
||||
options.Audience = "TODO";
|
||||
options.Authority = "TODO";
|
||||
// options.
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
@@ -19,6 +29,9 @@ if (app.Environment.IsDevelopment())
|
||||
app.MapOpenApi();
|
||||
}
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
string[] summaries =
|
||||
["Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"];
|
||||
|
||||
@@ -34,7 +47,8 @@ app.MapGet("/weatherforecast", () =>
|
||||
.ToArray();
|
||||
return forecast;
|
||||
})
|
||||
.WithName("GetWeatherForecast");
|
||||
.WithName("GetWeatherForecast")
|
||||
.RequireAuthorization();
|
||||
|
||||
app.MapDefaultEndpoints();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user