Skip to content

Commit

Permalink
Add auth back in
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmackay committed Dec 15, 2024
1 parent 3fc5af4 commit 4d3de8f
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/WebUI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@

var initialScopes = builder.Configuration.GetSection("DownstreamApi:Scopes").Get<string[]>();

// TODO: Add auth back in
// builder.Services
// .AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
// .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"))
// .EnableTokenAcquisitionToCallDownstreamApi(initialScopes)
// .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi"))
// // TODO: Consider switching to session cache to make development easier
// // .AddDistributedTokenCaches()
// // .AddSessionTokenCaches();
// .AddInMemoryTokenCaches();
//
// builder.Services.AddAuthorization(options =>
// {
// // By default, all incoming requests will be authorized according to the default policy.
// options.FallbackPolicy = options.DefaultPolicy;
// });
builder.Services
.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"))
.EnableTokenAcquisitionToCallDownstreamApi(initialScopes)
.AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi"))
// TODO: Consider switching to session cache to make development easier
// .AddDistributedTokenCaches()
// .AddSessionTokenCaches();
.AddInMemoryTokenCaches();

builder.Services.AddAuthorization(options =>
{
// By default, all incoming requests will be authorized according to the default policy.
options.FallbackPolicy = options.DefaultPolicy;
});

builder.Services.AddDistributedMemoryCache();

Expand Down

0 comments on commit 4d3de8f

Please sign in to comment.