Last active
February 23, 2021 03:46
-
-
Save fmshk97/0dad87d9768b8c9855545d6a01ec3776 to your computer and use it in GitHub Desktop.
Register authentication middleware in Startup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddIdentityCore<AppUser>(options => { | |
options.User.AllowedUserNameCharacters = "hojn._"; | |
}); | |
services.AddScoped<IUserStore<AppUser>, AppUserStore>(); | |
// Below line registers the authentication service in our app | |
// along with a cookie-based authentication scheme named "Cookies" | |
// "Cookies" is also set as the default authentication scheme | |
services.AddAuthentication(defaultScheme: "Cookies") | |
.AddCookie("Cookies"); | |
services.AddControllers(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment