Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Commit

Permalink
Change to other approach (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminsampica authored Aug 18, 2022
1 parent 16b233a commit 2398889
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,21 @@
options.Password.RequireNonAlphanumeric = false;
options.User.RequireUniqueEmail = true;
options.SignIn.RequireConfirmedAccount = true;

// Needed for .NET 6 Identity/ASP.NET Core bug - https://github.com/dotnet/core/blob/main/release-notes/6.0/known-issues.md#spa-template-issues-with-individual-authentication-when-running-in-production
// TODO: Revisit in .NET 7
var issuerUri = builder.Configuration.GetValue<string>("IdentityServer:IssuerUri");
if (!string.IsNullOrEmpty(issuerUri))
{
options.Tokens.AuthenticatorIssuer = issuerUri;
}
})
.AddRoles<ApplicationRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddClaimsPrincipalFactory<CurrentUserClaimsFactory>();

builder.Services.AddIdentityServer()
builder.Services.AddIdentityServer(options =>
{
// Needed for .NET 6 Identity/ASP.NET Core bug - https://github.com/dotnet/core/blob/main/release-notes/6.0/known-issues.md#spa-template-issues-with-individual-authentication-when-running-in-production
// TODO: Revisit in .NET 7
var issuerUri = builder.Configuration.GetValue<string>("IdentityServer:IssuerUri");
if (!string.IsNullOrEmpty(issuerUri))
{
options.IssuerUri = issuerUri;
}
})
.AddApiAuthorization<ApplicationUser, ApplicationDbContext>();

builder.Services.AddTransient<IProfileService, ProfileService>();
Expand Down

0 comments on commit 2398889

Please sign in to comment.