Logging failed Assertions


I’ve been logging Assertions as they come in but whenever ReceiveSsoAsync throws it doesn’t look like the OnSamlAssertionReceived happens so my delegate never gets called. I’ve got an issue where the Assertion is parsed normally but the Status is not Success and I want to see what’s in the Assertion in production.

Is there something I can do to get the assertion logged without a successful ReceiveSsoAsync? Am I doing something wrong or is this just the way it has to be?

I assign the delegate prior to calling ReceiveSsoAsync.


If the SAML response status isn’t success, no SAML assertion is included in the SAML response.

Instead of OnSamlAssertionReceived, use OnSamlResponseReceived. This is called regardless of the SAML response status.

Thanks, that’ll work for now. The only bummer is that when the assertion is encrypted it’s not as helpful but we’ll work with it.


That’s true. However, you could use OnSamlResponseReceived to handle unsuccessful SAML responses and OnSamlAssertionReceived for successful SAML responses.