Access to the DI system within SamlAuthenticationHandler

Hello,

When using the extension AddSaml(), any interaction goes through the SamlAuthenticationHandler, the ISamlServiceProvider.Events is replaced by the Handler’s Events.
I need to have access to the DI system for an event (OnSamlAssertionReceived). If I inherit from SamlServiceProvider and add my options in my constructor (would register my overridden SamlServiceProvider class in the DI and this have access to the DI there), the options are overridden by the Handler’s option thus any options I setup in that class disappears.

Hidding the method for instance ReceiveSsoAsync() and setting up my events there works.

Would it be possible to add in the Events arguments Action the HttpContext so that we can go and have access to the IServiceProvider (or have access to the IServiceProvider altogether) ?

For example in the ISamlServiceProviderEvents interface:
From:
System.Action OnSamlAssertionReceived { get; set; }
To:
System.Action<SamlAssertion,HttpContext> OnSamlAssertionReceived { get; set; }

This would simplify a lot the process

Thank you

In v2.6.0 we refactored the SAML authentication handler to support the same events as the ISamlServiceProvider including the OnSamlAssertionReceived.

If you’re using an earlier release, please contact support@componentspace.com for upgrade options.

[quote]
ComponentSpace - 4/22/2020
In v2.6.0 we refactored the SAML authentication handler to support the same events as the ISamlServiceProvider including the OnSamlAssertionReceived.

If you're using an earlier release, please contact support@componentspace.com for upgrade options.
[/quote]

I am using v2.9.0. However, SAMLAuthenticationHandler events (i.e. ISamlServiceProviderEvents) doesn't have access to the HttpContext, as such I can't use anything DI related directly in those.

For instance System.Action OnSamlAssertionReceived { get; set; } in ISamlServiceProviderEvents, passes a SamlAssertion. I would like to have access to the HttpContext so that I can reference stuff in my DI.

Also the Handler replaces the Events in the SamlServiceProvider from the Options event of the Handler. This means that if I have a class that derives from SamlServiceProvider and I set my events in my constructor, the Event I set will be replaced and not added to the ones from Handler.Options.

We’ll look at adding the HttpContext as suggested.

Please contact support@componentspace.com to discuss time frames and accessing a beta release.