Open Closed

Tring to get ProcessSignInContext event from AuthServer #8850


User avatar
0
sghorakavi@cpat.com created
  • ABP Framework version: 9.0.4
  • UI Type: MVC / Blazor WASM / Blazor Server
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi, I can get ProcessSignOutContext event fine. But Not getting ProcessSignInContext event in the Authserver. I have a class and registered it using

PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
{
    serverBuilder.AddEventHandler(SignInControl.Descriptor);
});

public class SignInControl : IOpenIddictServerHandler<ProcessSignInContext>
{
    public static OpenIddictServerHandlerDescriptor Descriptor { get; }
        = OpenIddictServerHandlerDescriptor.CreateBuilder<ProcessSignInContext>()
            .UseSingletonHandler<OpenIddictCreateIdentitySession>()
            .SetOrder(100_000)
            .SetType(OpenIddictServerHandlerType.Custom)
            .Build();
    protected IdentitySessionManager IdentitySessionManager { get; }
    protected IWebClientInfoProvider WebClientInfoProvider { get; }
    protected IOptions<AbpAccountOpenIddictOptions> Options { get; }
    public SignInControl(IdentitySessionManager identitySessionManager, IWebClientInfoProvider webClientInfoProvider, IOptions<AbpAccountOpenIddictOptions> options)
    {
        IdentitySessionManager = identitySessionManager;
        WebClientInfoProvider = webClientInfoProvider;
        Options = options;
    }

    public ValueTask HandleAsync(ProcessSignInContext context)
    {
    //...
    }
    }
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hello,

    Can you try the following code?

    public sealed class MyPrepareIdentityTokenPrincipal : IOpenIddictServerHandler<OpenIddictServerEvents.ProcessSignInContext>
    {
        public static OpenIddictServerHandlerDescriptor Descriptor { get; }
            = OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.ProcessSignInContext>()
                .AddFilter<OpenIddictServerHandlerFilters.RequireIdentityTokenGenerated>()
                .UseSingletonHandler<MyPrepareIdentityTokenPrincipal>()
                .SetOrder(OpenIddictServerHandlers.PrepareIdentityTokenPrincipal.Descriptor.Order + 1)
                .SetType(OpenIddictServerHandlerType.Custom)
                .Build();
    
        public ValueTask HandleAsync(OpenIddictServerEvents.ProcessSignInContext context)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }
    
            // ....
    
            return default;
        }
    }
    

    Then add it to the PreConfigureServices method of the module class as follows:

            public override void PreConfigureServices(ServiceConfigurationContext context)
            {
                //  ....
                
    
                PreConfigure<OpenIddictServerBuilder>(builder =>
                {
                    builder.AddEventHandler(MyPrepareIdentityTokenPrincipal.Descriptor);
                });
            }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
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 September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.