Activities of "maliming"

Answer

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.

hi

If you don't need to use HandleSelector, then you don't need to yograde packages.

  • If your event handler is not invoked, the Processed will be true.
  • If your event handler is invoked without exceptions, the Processed will be true.
  • If your event handler is invoked and throws any exceptions, the Processed will be false.

hi

I can create a demo project, but I don't have an external user account with extra claims.

That’s why I ask you to share a project and test BankID user info.

Thanks.

hi

I hard-coded the tenant ID and tested in a Blazor Server project. And it works

see video: https://streamable.com/ydbb20

raw video: https://we.tl/t-YZoGwV7p6C

Showing 2541 to 2550 of 12921 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❀️ on ABP v10.8.0-preview. Updated on November 02, 2026, 06:56
1
ABP Assistant
πŸ” You need to be logged in to use the chatbot. Please log in first.