Hi,
I am new to abp.io framework and we tried in exploring the functionality of SSO using AzureAD and we did able to get that working with the help of the documentation provided in the website. We are facing 2 challenges currently and highly appreciate if someone can help us.
After the successful login verification using openid , the application is not allowing the user to enter into the site instead it is circling back to the login page again. Not sure what i am missing.
But we would like to store the user information after the user credentials is verified.
Thanks Sundar
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
context.Services.AddAuthentication()
//.AddMicrosoftIdentityWebApp(configuration, "AzureAd", OpenIdConnectDefaults.AuthenticationScheme)
//.EnableTokenAcquisitionToCallDownstreamApi()
//.AddInMemoryTokenCaches();
.AddOpenIdConnect("AzureOpenId", "Azure AD OpenId", options =>
{
options.Authority = "https://login.microsoftonline.com/" + configuration["AzureAd:TenantId"] + "/v2.0/";
options.ClientId = configuration["AzureAd:ClientId"];
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.CallbackPath = configuration["AzureAd:CallbackPath"];
options.ClientSecret = configuration["AzureAd:ClientSecret"];
options.RequireHttpsMetadata = false;
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("email");
options.ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "sub");
});
if (!configuration.GetValue<bool>("App:DisablePII"))
{
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
Microsoft.IdentityModel.Logging.IdentityModelEventSource.LogCompleteSecurityArtifact = true;
}
if (!configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata"))
{
Configure<OpenIddictServerAspNetCoreOptions>(options =>
{
options.DisableTransportSecurityRequirement = true;
});
Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedProto;
});
}
ConfigureBundles();
ConfigureUrls(configuration);
ConfigurePages(configuration);
ConfigureImpersonation(context, configuration);
ConfigureHealthChecks(context);
ConfigureCookieConsent(context);
ConfigureAuthentication(context);
ConfigureAutoMapper();
ConfigureVirtualFileSystem(hostingEnvironment);
ConfigureNavigationServices();
ConfigureAutoApiControllers();
ConfigureSwaggerServices(context.Services);
ConfigureTheme();
Configure<PermissionManagementOptions>(options =>
{
options.IsDynamicPermissionStoreEnabled = true;
});
Configure<RazorPagesOptions>(options =>
{
options.Conventions.AuthorizePage("/Books/Index", TitanSecurityPermissions.Books.Default);
options.Conventions.AuthorizePage("/Books/CreateModal", TitanSecurityPermissions.Books.Create);
options.Conventions.AuthorizePage("/Books/EditModal", TitanSecurityPermissions.Books.Edit);
});
}
5 Answer(s)
-
0
hi
After the successful login verification using openid , the application is not allowing the user to enter into the site instead it is circling back to the login page again. Not sure what i am missing.
What do you mean? Can you share a GIF to show that?
But we would like to store the user information after the user credentials is verified.
There is an
OnUserInformationReceived
event ofOpenIdConnect
, You can get user info and store it in this method..AddOpenIdConnect("AzureOpenId", "Azure AD OpenId", options => { options.Authority = "https://login.microsoftonline.com/" + configuration["AzureAd:TenantId"] + "/v2.0/"; options.ClientId = configuration["AzureAd:ClientId"]; options.ResponseType = OpenIdConnectResponseType.CodeIdToken; options.CallbackPath = configuration["AzureAd:CallbackPath"]; options.ClientSecret = configuration["AzureAd:ClientSecret"]; options.RequireHttpsMetadata = false; options.SaveTokens = true; options.GetClaimsFromUserInfoEndpoint = true; options.Scope.Add("email"); options.ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "sub"); options.Events = new OpenIdConnectEvents() { OnUserInformationReceived = c => { } }; });
-
0
-
0
Hi
The register page inputs are empty that’s mean abp doesn’t get the
email
claim after sucessful AzureAD validation. -
0
Hi ,
I am not sure whether it is a bug or missing any configuration.
Thanks Sundar
-
0