Created
April 5, 2021 05:44
-
-
Save FacileTechnolab/74f053ef2bb9b53c1b5c34bc43c43094 to your computer and use it in GitHub Desktop.
Configure Startup.cs for Azure AD Authentication
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
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) | |
.AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd")); | |
services.AddControllersWithViews(options => | |
{ | |
var policy = new AuthorizationPolicyBuilder() | |
.RequireAuthenticatedUser() | |
.Build(); | |
options.Filters.Add(new AuthorizeFilter(policy)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment