Skip to content
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

Add WantAssertionsSigned #536

Merged
merged 52 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
928010f
Add the option wantassertionssigned
HendrikJan Feb 13, 2021
94764e5
Add wantAssertionsSigned to the README.
HendrikJan Feb 13, 2021
6e9d6bb
Make WantAssertionsSigned UCFirst in the XML
HendrikJan Feb 13, 2021
9e2a1f6
Use '@' in the same way as `@protocolSupportEnumeration' even though …
HendrikJan Feb 13, 2021
3b2cb2a
Use true instead of the truthy value.
HendrikJan Feb 13, 2021
5b4b18b
Add test for WantAssertionsSigned
HendrikJan Feb 13, 2021
8c3c02f
Fix typo
HendrikJan Feb 15, 2021
e4d126d
Always validate assertion when WantAssertionsSigned is truthy..
HendrikJan Feb 15, 2021
d17ffd3
Added test nr 1: signed response with unsigned unencrypted assertion
HendrikJan Feb 20, 2021
fe98b22
Put cert in the options, so we can leave it out in one of the upcomin…
HendrikJan Feb 20, 2021
4a1f4b2
Added test nr 3: unsigned response with signed unencrypted assertion …
HendrikJan Feb 20, 2021
1174bdd
their changes
cjbarth Feb 20, 2021
84ffbaa
Merge branch 'local-merge' into 536
cjbarth Feb 20, 2021
c691231
Add the option wantassertionssigned
HendrikJan Feb 13, 2021
fbff1a7
Add wantAssertionsSigned to the README.
HendrikJan Feb 13, 2021
c3adf5a
Make WantAssertionsSigned UCFirst in the XML
HendrikJan Feb 13, 2021
daf138d
Use '@' in the same way as `@protocolSupportEnumeration' even though …
HendrikJan Feb 13, 2021
65d55cd
Use true instead of the truthy value.
HendrikJan Feb 13, 2021
bb435f5
Add test for WantAssertionsSigned
HendrikJan Feb 13, 2021
647d6a8
Fix typo
HendrikJan Feb 15, 2021
5177ba1
Always validate assertion when WantAssertionsSigned is truthy..
HendrikJan Feb 15, 2021
ef742ec
Added test nr 1: signed response with unsigned unencrypted assertion
HendrikJan Feb 20, 2021
04f874d
Put cert in the options, so we can leave it out in one of the upcomin…
HendrikJan Feb 20, 2021
c65fda4
Added test nr 3: unsigned response with signed unencrypted assertion …
HendrikJan Feb 20, 2021
9ad6418
Fix error due to faulty rebase
HendrikJan Feb 20, 2021
f9a102f
Fix another error from rebasing.
HendrikJan Feb 20, 2021
1c8f409
Merge branch 'add_wantassertionssigned' of github.com:HendrikJan/pass…
HendrikJan Feb 20, 2021
b29aeb4
Merge branch 'add_wantassertionssigned' of github.com:HendrikJan/pass…
HendrikJan Feb 20, 2021
29bb521
Added test nr 2: signed response with unsigned encrypted assertion
HendrikJan Feb 20, 2021
c28441a
Added test nr4: unsigned response with with signed encrypted assertio…
HendrikJan Feb 20, 2021
1f52f23
Encrypt again to check out difference
HendrikJan Feb 20, 2021
c8f779e
Format xml for easier reading.
HendrikJan Feb 20, 2021
ccdcc6a
Added test nr5: signed response with signed unencrypted assertion so …
HendrikJan Feb 20, 2021
b1950d0
Added test nr6: signed response with signed encrypted assertion so th…
HendrikJan Feb 20, 2021
66c2d22
Move wantAssertionsSigned+cert options check to initialization and re…
HendrikJan Feb 21, 2021
f6bce34
Fixed duplicate test name.
HendrikJan Feb 21, 2021
bb0c32d
Remove unused response
HendrikJan Feb 21, 2021
eb6ad56
Change confusing error message.
HendrikJan Feb 22, 2021
1f5ee9f
Seem to make some progress signing and encrypting at the same time.
HendrikJan Feb 26, 2021
c9ad239
All tests now seem to work as expected -- have to check them.
HendrikJan Feb 26, 2021
aef2b44
Added temp readme to track all tests
HendrikJan Feb 26, 2021
ea24ba7
Added names of the tests to the TEMP_README
HendrikJan Feb 26, 2021
b4895be
Refactor, make "cert" default test option in testOneResponse..
HendrikJan Feb 26, 2021
d487cdf
Check that all root signatures are checked in the relevant tests
HendrikJan Feb 26, 2021
b8576f5
Finished temp list of test.
HendrikJan Feb 26, 2021
dfcd486
Merge pull request #1 from HendrikJan/wantassertionssigned_tmp
HendrikJan Feb 26, 2021
be3bdbe
Cleanup.
HendrikJan Feb 26, 2021
e41ac38
Merge branch 'master' of github.com:node-saml/passport-saml into add_…
HendrikJan Feb 26, 2021
dd3d5ea
Revert package-lock so not to appear in PR changes.
HendrikJan Feb 26, 2021
4e18204
Copied all changes from add_wantassertionssigned onto the new master …
HendrikJan Mar 20, 2021
b48e0da
Merge new changes from master branch into add_wantassertionssigned an…
HendrikJan Mar 20, 2021
cd6e4fe
Use the type SamlConfig instead as that better represents what a cons…
HendrikJan Mar 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ type Profile = {
- `additionalParams`: dictionary of additional query params to add to all requests; if an object with this key is passed to `authenticate`, the dictionary of additional query params will be appended to those present on the returned URL, overriding any specified by initialization options' additional parameters (`additionalParams`, `additionalAuthorizeParams`, and `additionalLogoutParams`)
- `additionalAuthorizeParams`: dictionary of additional query params to add to 'authorize' requests
- `identifierFormat`: if truthy, name identifier format to request from identity provider (default: `urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress`)
- `wantAssertionsSigned`: it truthy, add `WantAssertionsSigned="true"` to the metadata, to specify that the IdP should always sign the assertions.
cjbarth marked this conversation as resolved.
Show resolved Hide resolved
- `acceptedClockSkewMs`: Time in milliseconds of skew that is acceptable between client and server when checking `OnBefore` and `NotOnOrAfter` assertion condition validity timestamps. Setting to `-1` will disable checking these conditions entirely. Default is `0`.
- `attributeConsumingServiceIndex`: optional `AttributeConsumingServiceIndex` attribute to add to AuthnRequest to instruct the IDP which attribute set to attach to the response ([link](http://blog.aniljohn.com/2014/01/data-minimization-front-channel-saml-attribute-requests.html))
- `disableRequestedAuthnContext`: if truthy, do not request a specific authentication context. This is [known to help when authenticating against Active Directory](https://github.com/node-saml/passport-saml/issues/226) (AD FS) servers.
Expand Down
4 changes: 4 additions & 0 deletions src/passport-saml/saml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,10 @@ class SAML {
metadata.EntityDescriptor.SPSSODescriptor.NameIDFormat = this.options.identifierFormat;
}

if (this.options.wantAssertionsSigned) {
metadata.EntityDescriptor.SPSSODescriptor["@WantAssertionsSigned"] = true;
}

metadata.EntityDescriptor.SPSSODescriptor.AssertionConsumerService = {
"@index": "1",
"@isDefault": "true",
Expand Down
1 change: 1 addition & 0 deletions src/passport-saml/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface SAMLOptions {
idpIssuer: string;
audience: string;
scoping: SamlScopingConfig;
wantAssertionsSigned: boolean;

// InResponseTo Validation
validateInResponseTo: boolean;
Expand Down
18 changes: 18 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,24 @@ describe("passport-saml /", function () {
metadata.should.containEql(samlConfig.logoutCallbackUrl);
});

it("generateServiceProviderMetadata contains WantAssertionsSigned", function () {
HendrikJan marked this conversation as resolved.
Show resolved Hide resolved
var samlConfig = {
issuer: "http://example.serviceprovider.com",
callbackUrl: "http://example.serviceprovider.com/saml/callback",
identifierFormat: "urn:oasis:names:tc:SAML:2.0:nameid-format:transient",
decryptionPvk: fs.readFileSync(__dirname + "/static/testshib encryption pvk.pem"),
wantAssertionsSigned: true,
};

var samlObj = new SAML(samlConfig);
var decryptionCert = fs.readFileSync(
__dirname + "/static/testshib encryption cert.pem",
"utf-8"
);
var metadata = samlObj.generateServiceProviderMetadata(decryptionCert);
metadata.should.containEql('WantAssertionsSigned="true"');
});

it("#certToPEM should generate valid certificate", function (done) {
var samlConfig = {
entryPoint: "https://app.onelogin.com/trust/saml2/http-post/sso/371755",
Expand Down