Custom session store does not save the session

I’ve implemented a custom session store that saves the session in a SQL Server table. When called the InitiateSsoAsync, it passes through SaveAsync of my custom store, and I can see that the SsoSessions inside ServiceProviderSessionState does not have a value. Attached is a screenshot of what I’m seeing.

When completing the flow, I can see in the logs that it says “Initiation of SSO to the partner identity provider xxxxx has completed successfully.” But since the session from the cache does not contain any value, it throws an error when doing the single logout flow. The error says “ComponentSpace.Saml2.Exceptions.SamlProtocolException: There is no SSO session to partner xxxxx to logout”.

I’m testing this via Postman. Please advise.

The SSO state looks correct, assuming this is after calling InitiateSsoAsync and prior to calling ReceiveSsoAsync.

After calling InitiateSsoAsync, there should be one entry in the PendingResponseState and no entries in the SsoSessions.

After ReceiveSsoAsync returns successfully, there should be no entry in the PendingResponseState and one entry in the SsoSessions.

Make sure this is the case prior to the single logout flow.

Also, we use a saml-session cookie as an index into the SSO state. If you’re testing with Postman, make sure it sends this cookie.