Created
December 6, 2017 12:52
-
-
Save HamidMosalla/d30706da9c84d9b680d0fd03ff1f1fd4 to your computer and use it in GitHub Desktop.
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.AddMvc(); | |
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); | |
services.AddAuthentication(options => | |
{ | |
options.DefaultScheme = "Cookies"; | |
options.DefaultChallengeScheme = "oidc"; | |
}) | |
.AddCookie("Cookies") | |
.AddOpenIdConnect("oidc", options => | |
{ | |
options.SignInScheme = "Cookies"; | |
options.Authority = "http://localhost:5000"; | |
options.RequireHttpsMetadata = false; | |
options.ClientId = "mvc"; | |
options.ClientSecret = "secret"; | |
options.ResponseType = "code id_token"; | |
options.SaveTokens = true; | |
options.GetClaimsFromUserInfoEndpoint = true; | |
options.Scope.Add("Api1"); | |
options.Scope.Add("offline_access"); | |
}); | |
services.AddAuthorization(options => options.AddPolicy("Founder", policy => policy.RequireClaim("Employee", "Mosalla"))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment