0
s.alshammari.c created
HI , I am using asp and angular I am trying to integrate Azure AD for Authentication.
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Add("sub", ClaimTypes.NameIdentifier);
context.Services.AddAuthentication()
.AddAzureAD(options => configuration.Bind("AzureAd", options));
context.Services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
{
options.Authority = "[https://login.microsoftonline.com/"](https://login.microsoftonline.com/%22 "https://login.microsoftonline.com/%22") + configuration["AzureAd:TenantId"] + "/v2.0/";
options.ClientId = configuration["AzureAd:ClientId"];
options.CallbackPath = configuration["AzureAd:CallbackPath"];
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.RequireHttpsMetadata = false;
options.TokenValidationParameters.ValidateIssuer = false;
options.GetClaimsFromUserInfoEndpoint = true;
options.SaveTokens = true;
options.SignInScheme = IdentityConstants.ExternalScheme;
options.Scope.Add("email");
options.ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "sub");
});
}
I get the following errors
9 Answer(s)
-
0
hi
This doesn't seem to be an abp problem. Can you test your code in a plain ASP Net core app?
-
0
-
0
hi
Http failure response
Please check the browser console/network panel to see if there are any messages.
-
0
-
0
hi
Can you share the
logs.txt
?liming.ma@volosoft.com
-
0
i sent to your email
-
0
hi
Do you have code like below in your
FormsHttpApiHostModule
?If so can you share the steps to reproduce this error in a new angular and aspnet core template app?
context.Services.AddCors(options => { options.AddDefaultPolicy(builder => { builder .WithOrigins( configuration["App:CorsOrigins"]? .Split(",", StringSplitOptions.RemoveEmptyEntries) .Select(o => o.Trim().RemovePostFix("/")) .ToArray() ?? Array.Empty<string>() ) .WithAbpExposedHeaders() .SetIsOriginAllowedToAllowWildcardSubdomains() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); });
app.UseCors();
app.UseStaticFiles(); app.UseRouting(); app.UseCors();
-
0
yes I have the code like the one you sent.
I don't know how to reproduce the problem .
-
0
Can you share a simple project to reproduce?
Thanks
liming.ma@volosoft.com