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)
{
//...
}
}
1 Answer(s)
-
0
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); }); }