Skip to content

Commit 8e84455

Browse files
committed
Merge pull request #93 from vesse/saml2p-logout
SessionIndex / WSO2 logout
2 parents 4a91fce + b9472d8 commit 8e84455

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

lib/passport-saml/saml.js

+14
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ SAML.prototype.generateLogoutRequest = function (req) {
184184
}
185185
};
186186

187+
if (req.user.sessionIndex) {
188+
request['samlp:LogoutRequest']['saml2p:SessionIndex'] = {
189+
'@xmlns:saml2p': 'urn:oasis:names:tc:SAML:2.0:protocol',
190+
'#text': req.user.sessionIndex
191+
};
192+
}
193+
187194
return xmlbuilder.create(request).end();
188195
};
189196

@@ -534,6 +541,13 @@ SAML.prototype.processValidlySignedAssertion = function(xml, inResponseTo, callb
534541
profile.issuer = issuer[0];
535542
}
536543

544+
var authnStatement = assertion.AuthnStatement;
545+
if (authnStatement) {
546+
if (authnStatement[0].$ && authnStatement[0].$.SessionIndex) {
547+
profile.sessionIndex = authnStatement[0].$.SessionIndex;
548+
}
549+
}
550+
537551
var subject = assertion.Subject;
538552
if (subject) {
539553
var nameID = subject[0].NameID;

test/tests.js

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)