ComponentSpace

Forums



Access to the DI system within SamlAuthenticationHandler


Access to the DI system within SamlAuthenticationHandler

Author
Message
dominiquesa.eq
dominiquesa.eq
New Member
New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)

Group: Forum Members
Posts: 2, Visits: 4
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<SamlAssertion> OnSamlAssertionReceived { get; set; }
To:
System.Action<SamlAssertion,HttpContext> OnSamlAssertionReceived { get; set; }

This would simplify a lot the process

Thank you
ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
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 [email protected] for upgrade options.

Regards
ComponentSpace Development
dominiquesa.eq
dominiquesa.eq
New Member
New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)New Member (3 reputation)

Group: Forum Members
Posts: 2, Visits: 4
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 [email protected] for upgrade options.

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<SamlAssertion> 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.


ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
We'll look at adding the HttpContext as suggested.

Please contact [email protected] to discuss time frames and accessing a beta release.

Regards
ComponentSpace Development
GO


Similar Topics


Execution: 0.000. 2 queries. Compression Enabled.
Login
Existing Account
Email Address:


Password:


Select a Forum....












Forums, Documentation & Knowledge Base - ComponentSpace


Search