-
Notifications
You must be signed in to change notification settings - Fork 475
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
InResponseTo SubjectConfirmation validation support #37
Conversation
Looks pretty good! Some thoughts:
|
Regarding the in-memory cache of request ids... maybe the feature could provide the simple in-memory version for simple scenarios by default, but be extensible and allow the caller to provide an implementation for storing, checking for existence, and deleting from some cache of ids. Basically 'Bring Your Own Cache'. This should make the validation checking feasible for multiple servers. Ok yes, my oversight on not running JSHint. Will get that cleaned up. And yes, digging into the spec on SubjectConfirmation, I realized those validation timestamps can occur in multiple places in the SAML response. I will submit another PR to supplement issue #35 for this. |
…ovide in-memory default implementation
latest changes:
|
Awesome, working on integrating this. I think, though, that we may want to allow for custom 'serialization providers' rather than custom 'cache providers'. In my thinking, a serialization provider just needs to know how to store and return values, which is all we really need, while a cache provider needs to have more complicated behavior that is aware of the semantics of what is being stored. Might as well keep the additional work as minimal as possible for anyone who needs to build glue code here, since the cache policy should always be the same. I'll take a stab at that change and see how it works out. |
After thinking about this some more, I think your way is better. It would be nice to take care of cache expiration so that anyone using this doesn't have to worry about it... but doing cache expiration efficiently probably requires knowledge of the underlying datastore. |
Just added some more commits that merge in from master all the latest to save you the trouble. Wasn't trivial to get the tests working again, it seems when using the |
Ok, sorry for the quick succession of changes. Fixed JSHint errors, and realized I had some code duplication and parsing out the |
Oops, I had a very similar set of changes in progress, just hadn't gotten them checked in. :-) I changed the interface to get rid of the 'exists' method, since 'get' provides the same information and I figure that can make it that much easier for someone to implement their own provider. Also, I changed saml.js to set the createdAt time in the value field, and check it when it looks up a token. That way it's not relying on the provider's expiration policy to make the tokens invalid, and if a provider doesn't implement expiration, it will grow without bound but they will still expire as expected. Just landed this; let me know if the reconciled version looks good to you. |
Checked out what was merged into master and I think there's one issue:
Other than that, looks good. |
One last thing - looks like |
Updated the README. I thought I had gotten the useFakeTimers changes sorted out during my merge. I see that you changed the time format, but I think that one's fine either way -- I actually kinda prefer the ISO format since it is easier to match to the xml. Is there a part of the unit tests that isn't working right now? |
On line 119 of Once all of those tests are actually executing, you will see problems with setTimeout actually firing in the ResponseTo tests, and 3 of the 4 saml response tests are failing. My later commits to this PR should resolve all those test issues. |
Ah, got it, thanks. Should be fixed in the latest. |
This PR is for support for validation the InResponseTo attribute and limited support for the SubjectConfirmation element of a SAML response.
Id
attribute of generated SAML requests are cached in the module when support for the InResponseTo validation is turned onInResponseTo
in the rootResponse
element and validate that it has been seen before (hit in the cache)InResponseTo
attribute in theSubjectConfirmationData
element if supplied. This value must match the top level id and hit the cache as wellInResponseTo
is by default false, perhaps it is better to be more restrictive, although this could break existing clients