Hi,
The value has come from the login callback.
This is the design that lets external users confirm their information.
You can override the register
page to create a user in the OnGetAsnc
method if you want.
For example:
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(RegisterModel))]
public class MyRegisterModel : RegisterModel
{
public override async Task<IActionResult> OnGetAsync()
{
ExternalProviders = await GetExternalProviders();
if (IsExternalLogin)
{
await TrySetEmailAsync();
var externalLoginInfo = await SignInManager.GetExternalLoginInfoAsync();
if (externalLoginInfo == null)
{
Logger.LogWarning("External login info is not available");
return RedirectToPage("./Login");
}
if (Input.UserName.IsNullOrWhiteSpace())
{
Input.UserName = await UserManager.GetUserNameFromEmailAsync(Input.EmailAddress);
}
user = await RegisterExternalUserAsync(externalLoginInfo, Input.UserName, Input.EmailAddress);
await SignInManager.SignInAsync(user, isPersistent: true);
// Clear the dynamic claims cache.
await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
return Redirect(ReturnUrl ?? "/");
}
if (!await CheckSelfRegistrationAsync())
{
if (IsExternalLoginOnly)
{
return await OnPostExternalLogin(ExternalLoginScheme);
}
Alerts.Warning(L["SelfRegistrationDisabledMessage"]);
return Page();
}
await SetUseCaptchaAsync();
return Page();
await TrySetEmailAsync();
}
}
Hi,
This is a registration page for external users.
The user just needs to confirm his information
Hi,
You can try:
options.TokenValidationParameters = new TokenValidationParameters()
{
ValidAudiences = new[] { "....", "...." }// add all audiences that you want to validate
};
I only get login to work when I set this setting to None. It doesn't feel right thing to do. But is there any other way? options.MinimumSameSitePolicy = Microsoft.AspNetCore.Http.SameSiteMode.None;
Are you using HTTPS?
Is there possibility to get login working without enabling self-registration when using Azure Entra Id?
Yes, you can disable self-registration, ABP will automatically register external users.
Hi,
It will be available in the next version
https://abp.io/support/questions/8864/New-Docker-support-added-Docker-compose#answer-3a186db6-09a7-007a-5a49-c044ee838458
We have explained how to run it in the README, so I think this change is unnecessary.
Hi,
This is because IOptions<..>
will cache the option instance. So it will not trigger every time.
You can try another way:
.AddOpenIdConnect("AzureOpenId", "Azure AD", 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");
// this event will call every time when redirect to azure.
options.Events.OnRedirectToIdentityProvider = async redirectContext =>
{
redirectContext.ProtocolMessage.ClientId = "xxxx";
redirectContext.ProtocolMessage.ClientSecret = "xxx";
};
})
Hi,
This is the expected behavior, because ABP uses proxies to create interceptors for things like units of work, auditing log.
Instead, I recommend you use lazy injection.
See: https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs#L57
They will only be loaded when first used to get better performance.
This is the test code https://drive.google.com/file/d/1Y9s39U8FAcPp9fzRdfFqxIfY_imbgXQS/view?usp=sharing if you want to check it.
In the context of using ABP framework classes, I have none of them include a RowVersion property or implement the IHasConcurrencyStamp interface. Therefore, encountering an AbpDbConcurrencyException is unexpected in this scenario. My requirement is to update records without considering concurrent modifications by other users.
This error does not come from ABP but EF core. ABP just catches and re-throw it.
See https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs#L255
Could you please adjust my code to achieve this behavior?
You need to capture the exception and handle it manually. (Ignore it or anything you want.)