-
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
Issue #206: Support signing AuthnRequests using the HTTP-POST Binding #207
Conversation
For further consideration, please reference the portions of the SAML spec that relate to the changes are making. Also, the branch needs to be updated to resolve conflicts with the current |
Thanks @richardTowers . How I can get your version of this code ? I have "passport-saml": "^0.33.0" These are missing from from my saml.js. Please confirm when you will release it ? |
@tusharbudhe0302 If you want to help move this toward release, you can provide specific references to the part of the SAML spec that this pull request implements. Should |
@richardTowers The docs need be clearer about the difference between the
While the latter is defined as:
And the values and defaults are exactly the same set of digest algorithms. If they are both digest algorithms for signing requests, how are they different? |
@richardTowers @markstos any work is being done on this PR? I'm by no means a SAML2 expert but for what is worth, the code looks good to me.
Here my grain of sand, protocol-wise: <Signature> element in <AuthnRequest>
<CanonicalizationMethod>See:
<Transforms>See:
Example:See full example in the spec:
|
@pzavolinsky If you want to move this toward release, you could address the feedback I left about the PR back in February, 2018. Thanks. |
Digest algorithm: http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-algsupport-v1.0-cs01.html#__RefHeading__5805_234507477 Also: https://github.com/yaronn/xml-crypto#api specifically:
Which produces a |
Regarding the difference between the two: my understanding is that the The digest algorithm is a simple hash function (e.g. Some info I've found on the subject:
|
Hi folks, apologies for dropping this and disappearing. I'll try and make some time to rebase this onto master and address @markstos' review comments. |
Hi there. Is there a plan in which release this will be included? I just would like to know if I should change my current development to Redirect as this will still take some time or if this can be expected to be released soon. @richardTowers |
Regarding the digestAlgorithm, from the SAML spec:
Example:
The Reference URI is the same as the AuthnRequest ID. This seems to be mandatory. The W3 link from above implies the possibility/capability to include more References in the signature, although I'm not sure what they would be exactly:
also
Anyway I might propose that the
On a related note, PR #274 seems to address the same POST+signing issue, but this solution is potentially more correct by having a separate DigestAlgorithm. |
I have tried testing the code submitted back in 2017, and it does add a signature to the AuthnRequest. However, my IdP (a PingFederate server) is still not accepting the request, apparently because the Signature is in the wrong order. It seems that, to be 100% correct, the signature should immediately follow the Issuer element, before other elements such as NameIDPolicy. See this link: You can see this "error" reflected in my AuthnRequest above which was generated using the code from this PR. If @richardTowers could help with this that would be excellent as this is all new to me. Regardless I will likely try looking into it myself as HTTP-POST signing is important functionality for me. |
You are right here, it has to directly follow the Issuer tag. I can also try to support with general SAML questions and information, as I am creating an infrastructure (IdP and SPs) with SAML based on POST-Binding and had to study this functionality quite a bit. |
…T Binding This commit adds support for signing AuthnRequests in the SAML HTTP-POST binding. In the POST Binding the signature sits inside the SAML message (as opposed to the Redirect binding, where the signture lives in the URL's query string). This will help suppport identity providers that require signed AuthnRequests over the HTTP-POST binding. Two new configuration options have been added: * `digestAlgorithm`: allows you to specify the digest algorithm for the signature. * `xmlSignatureTransforms`: allows you to configure which XML transforms to use.
It's not exactly easy to explain XMLDSIG in a single bullet point in a readme, so I think this is necessarily going to be a bit confusing.
👋 hello from the future! I've rebased my work against current master, and the tests still seem to pass, so maybe this still works 🤷♂. I'm not working full time on a SAML solution these days, so I haven't re-tested the code against any third party code. I've also attempted to make the description of digestAlgorithm a bit less confusing, but at the end of the day it's SAML, so 🤷♂. If there are more changes needed I think it would be best for someone else to volunteer to take over on this PR, as it will probably take me at least another 3 years to respond to any feedback. |
Regarding the order of the elements and the position of the signature (as @crutley mentions): I think this is something that needs handling in the lower level As far as I can tell we just call |
I thought the same looking at the code here, but didn't want to say it! Anyway I took a look at
So, I'm just now looking into XPath for the first time, so I'm not 100% sure on the best/most robust/most flexible method, but that line could look something like:
At least, I'm guessing that 'after' is the 'action' we'd want. I don't know however if |
@crutley you are right. |
👍 - good spot! I've added that to this PR and written a test that the signature ends up in the right place. |
I've tested the newest commit against my company's PingFederate server. The HTTP-POST signing works, the signature is in the right place, and I'm getting a response back with attributes and everything! Now I just need to figure out how to get what I need out of the SAML response (edit: after fixing a dumb oversight on my part, it's all working!). Thanks a ton @richardTowers, this has been a big help for me! Hopefully the maintainers can get this code reviewed and merged so it can live its life in my project as a full-fledged citizen of npm, lol. |
This PR now includes code, tests, docs, spec references and some peer review and testing as well. Looks good to me. Merging. |
@crutley - just wondering if I could drop you a mail about getting passport-saml to work with PingID... I'm having a hell of a time, and you are the only person I can find who admits to getting it working... |
@dickiedyce Sorry for the late response, I'll send you an email. |
This commit adds support for signing AuthnRequests in the SAML HTTP-POST
binding. In the POST Binding the signature sits inside the SAML message
(as opposed to the Redirect binding, where the signture lives in the
URL's query string).
This will help suppport identity providers that require signed
AuthnRequests over the HTTP-POST binding.
Two new configuration options have been added:
digestAlgorithm
: allows you to specify the digest algorithm for thesignature.
xmlSignatureTransforms
: allows you to configure which XML transformsto use.