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

Change to other approach #147

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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