Skip to content

Commit

Permalink
Added auth back in
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmackay committed Dec 14, 2024
1 parent 05ef3b5 commit d1684b4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/WebUI/Features/DailyScrum/DailyScrumFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public sealed class DailyScrumFeature : IFeature
public static void ConfigureServices(IServiceCollection services, IConfiguration config)
{
//services.AddOptionsWithValidation<MicrosoftGraphOptions>(MicrosoftGraphOptions.Section);
services.AddScoped<IGraphService, MockGraphService>();
// services.AddScoped<IGraphService, GraphService>();
// services.AddScoped<IGraphService, MockGraphService>();
services.AddScoped<IGraphService, GraphService>();
services.AddScoped<TimeProvider, SydneyTimeProvider>();
}
}
28 changes: 15 additions & 13 deletions src/WebUI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@

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

// builder.Services
// .AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
// .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"))
// .EnableTokenAcquisitionToCallDownstreamApi(initialScopes)
// .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi"))
// // .AddDistributedTokenCaches()
// .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 d1684b4

Please sign in to comment.