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

feat: add RequestedAuthnContext Comparison Type parameter #360

Merged
merged 1 commit into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/adfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ passport.use(new SamlStrategy(
acceptedClockSkewMs: -1,
identifierFormat: null,
// this is configured under the Advanced tab in AD FS relying party
signatureAlgorithm: 'sha256'
signatureAlgorithm: 'sha256',
comparisonType: 'exact', // default to exact RequestedAuthnContext Comparison Type
},
function(profile, done) {
return done(null,
Expand Down
13 changes: 12 additions & 1 deletion lib/passport-saml/saml.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ SAML.prototype.initialize = function (options) {
options.signatureAlgorithm = 'sha1';
}

/**
* List of possible values:
* - exact : Assertion context must exactly match a context in the list
* - minimum: Assertion context must be at least as strong as a context in the list
* - maximum: Assertion context must be no stronger than a context in the list
* - better: Assertion context must be stronger than all contexts in the list
*/
if (!options.comparisonType || ['exact','minimum','maximum','better'].indexOf(options.comparisonType) === -1){
options.comparisonType = 'exact';
}

return options;
};

Expand Down Expand Up @@ -202,7 +213,7 @@ SAML.prototype.generateAuthorizeRequest = function (req, isPassive, callback) {

request['samlp:AuthnRequest']['samlp:RequestedAuthnContext'] = {
'@xmlns:samlp': 'urn:oasis:names:tc:SAML:2.0:protocol',
'@Comparison': 'exact',
'@Comparison': self.options.comparisonType,
'saml:AuthnContextClassRef': authnContextClassRefs
};
}
Expand Down
13 changes: 13 additions & 0 deletions test/tests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.