-
Notifications
You must be signed in to change notification settings - Fork 136
Store outstanding queries to disallow unsolicited responses #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store outstanding queries to disallow unsolicited responses #112
Conversation
src/satosa/backends/saml2.py
Outdated
| exc_info=True) | ||
| raise SATOSAAuthenticationError(context.state, "Failed to construct the AuthnRequest") from exc | ||
|
|
||
| if self.sp.config.allow_unsolicited is False: |
There was a problem hiding this comment.
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..
c8ab723 to
f698d85
Compare
src/satosa/backends/saml2.py
Outdated
| exc_info=True) | ||
| raise SATOSAAuthenticationError(context.state, "Failed to construct the AuthnRequest") from exc | ||
|
|
||
| if self.sp.config._sp_allow_unsolicited is False: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
f698d85 to
e8669fe
Compare
|
Regarding the problem that came up with the failed tests, pysaml2 As this attribute/configuration-option is available under the PS: See IdentityPython/pysaml2#430 |
SATOSA does not work with
allow_unsolicitedset tofalsefor a SAML backend.This commit introduces an in-memory dictionary that stores outstanding queries as needed and described by pysaml2:
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
SATOSAAuthenticationErroris raised.This could possibly be expanded to a real API that calls into some module that handles
storeandremoveoperations 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.