hi Can you try with a new database or clear the setting from database.
If still not working can share your test project?
liming.ma@volosoft.com
Thanks.
Ok
Unlocked. Please share the problem details. Thanks
Hi
You can inject AbpApplicationManager to update application/client entity.
https://abp.io/docs/latest/modules/openiddict#database-providers
hi
Add BankIdOpenIddictServerHandler
to your AuthServer project
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<OpenIddictServerBuilder>(builder =>
{
builder.AddEventHandler(BankIdOpenIddictServerHandler.Descriptor);
});
}
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using OpenIddict.Abstractions;
using OpenIddict.Server;
namespace BankIdDemo;
public class BankIdOpenIddictServerHandler : IOpenIddictServerHandler<OpenIddictServerEvents.ProcessSignInContext>
{
public static OpenIddictServerHandlerDescriptor Descriptor { get; }
= OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.ProcessSignInContext>()
.UseSingletonHandler<BankIdOpenIddictServerHandler>()
.SetOrder(100_000)
.SetType(OpenIddictServerHandlerType.Custom)
.Build();
public async ValueTask HandleAsync(OpenIddictServerEvents.ProcessSignInContext context)
{
if (context is { EndpointType: OpenIddictServerEndpointType.Authorization, AuthorizationCodePrincipal: not null})
{
var httpContext = context.Transaction.GetHttpRequest()?.HttpContext;
if (httpContext == null)
{
return;
}
var identity = await httpContext.AuthenticateAsync(IdentityConstants.ApplicationScheme);
if (identity?.Principal == null)
{
return;
}
var nationalidentitynumber =identity?.Principal?.FindFirst("nationalidentitynumber")?.Value;
if (!nationalidentitynumber.IsNullOrWhiteSpace())
{
context.AuthorizationCodePrincipal?.AddClaim("nationalidentitynumber", nationalidentitynumber);
}
return;
}
if (context is { EndpointType: OpenIddictServerEndpointType.Token, AccessTokenPrincipal: not null})
{
var nationalidentitynumber = context.AccessTokenPrincipal?.FindFirst("nationalidentitynumber")?.Value;
if (!nationalidentitynumber.IsNullOrWhiteSpace())
{
context.AccessTokenPrincipal?.AddClaim("nationalidentitynumber", nationalidentitynumber);
}
}
}
}
Great 👍
hi
Add the code below to fix the ReturnUrl issue. I will fix it in the next version
Thanks
Configure<AbpAccountOptions>(options =>
{
options.GetTenantDomain = (httpContext, tenantInfo) =>
{
var returnUrl = "";
if (httpContext.Request.HasFormContentType)
{
var form = httpContext.Request.Form;
if (form.ContainsKey("ReturnUrl"))
{
returnUrl = form["ReturnUrl"];
}
}
return Task.FromResult(httpContext.Request.Scheme + "://" + httpContext.Request.Host + httpContext.Request.PathBase + returnUrl);
};
});
Please create an Angular template project and share it with liming.ma@volosoft.com
Thanks.
hi
I will test your case with GitHub login.
Is that ok for you?
You can create an Angular template project and share it with liming.ma@volosoft.com
Thanks.
hi
You can call the await InvokeAsync(StateHasChanged)
after changing the SelectedTenantId
. Ensure the input has set the correct value.