Skip to content

Commit

Permalink
Merge pull request #93 from vesse/saml2p-logout
Browse files Browse the repository at this point in the history
SessionIndex / WSO2 logout
  • Loading branch information
ploer committed Jun 8, 2015
2 parents 4a91fce + b9472d8 commit 8e84455
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/passport-saml/saml.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ SAML.prototype.generateLogoutRequest = function (req) {
}
};

if (req.user.sessionIndex) {
request['samlp:LogoutRequest']['saml2p:SessionIndex'] = {
'@xmlns:saml2p': 'urn:oasis:names:tc:SAML:2.0:protocol',
'#text': req.user.sessionIndex
};
}

return xmlbuilder.create(request).end();
};

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

var authnStatement = assertion.AuthnStatement;
if (authnStatement) {
if (authnStatement[0].$ && authnStatement[0].$.SessionIndex) {
profile.sessionIndex = authnStatement[0].$.SessionIndex;
}
}

var subject = assertion.Subject;
if (subject) {
var nameID = subject[0].NameID;
Expand Down
34 changes: 34 additions & 0 deletions test/tests.js

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

0 comments on commit 8e84455

Please sign in to comment.