Skip to content

Conversation

@c00kiemon5ter
Copy link
Member

SATOSA does not work with allow_unsolicited set to false for a SAML backend.

This commit introduces an in-memory dictionary that stores outstanding queries as needed and described by pysaml2:

A dictionary with session IDs as keys and the original web request from the user before redirection as values.

Requests are added as new authn requests are created, and removed as matching authn responses are sent, if the module is configured not to accept unsolicited responses. If an unsolicited response is found it is logged and an SATOSAAuthenticationError is raised.

This could possibly be expanded to a real API that calls into some module that handles store and remove operations of the requests and gives the choice for the data to be persisted in a file or database to support across process handling of unsolicited responses.

exc_info=True)
raise SATOSAAuthenticationError(context.state, "Failed to construct the AuthnRequest") from exc

if self.sp.config.allow_unsolicited is False:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh noes! sp.config.allow_unsolicited does not set the correct value.
The correct value lies under self.sp.config._sp_allow_unsolicited..

@c00kiemon5ter c00kiemon5ter force-pushed the feature-disallow-unsolicited-support branch from c8ab723 to f698d85 Compare July 11, 2017 10:00
exc_info=True)
raise SATOSAAuthenticationError(context.state, "Failed to construct the AuthnRequest") from exc

if self.sp.config._sp_allow_unsolicited is False:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR passes the tests now, but this right here (peeking at _-prefixed/internal data) is really ugly. It should be fixed in pysaml2 (config.py). I will have a look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you let us know if this can be easily addressed in pysaml2 ? I agree with you that this is ugly and we shouldn't let it in

Copy link
Member Author

@c00kiemon5ter c00kiemon5ter Jul 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with a more standard approach.

@c00kiemon5ter c00kiemon5ter force-pushed the feature-disallow-unsolicited-support branch from f698d85 to e8669fe Compare July 11, 2017 11:34
@c00kiemon5ter
Copy link
Member Author

c00kiemon5ter commented Jul 11, 2017

Regarding the problem that came up with the failed tests, pysaml2 sp.config object exposes the allow_unsolicited attribute, which is misleading. It should be removed from the config object.

As this attribute/configuration-option is available under the services.sp key, it should be accessed using sp.config.getattr(<attribute/configuration-key>, <context>) which in our case is sp.config.getattr('allow_unsolicited', 'sp').

PS: See IdentityPython/pysaml2#430

@johanlundberg johanlundberg merged commit 85a1090 into IdentityPython:master Jul 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants