Skip to content

Commit

Permalink
Extend and document the profile object
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbarth committed Sep 27, 2018
1 parent f82d141 commit faccd89
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,28 @@ passport.use(new MultiSamlStrategy(
);
```

#### The profile object:

The profile object referenced above contains the following:

```typescript
type Profile = {
issuer?: string;
sessionIndex?: string;
nameID?: string;
nameIDFormat?: string;
nameQualifier?: string;
spNameQualifier?: string;
mail?: string; // InCommon Attribute urn:oid:0.9.2342.19200300.100.1.3
email?: string; // `mail` if not present in the assertion
getAssertionXml(): string; // get the raw assertion XML
getAssertion(): object; // get the assertion XML parsed as a JavaScript object
ID?: string;
} & {
[attributeName: string]: string; // arbitrary `AttributeValue`s
}
```
#### Config parameter details:
* **Core**
Expand Down
6 changes: 5 additions & 1 deletion lib/passport-saml/saml.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,11 @@ SAML.prototype.processValidlySignedAssertion = function(xml, inResponseTo, callb
var nowMs = new Date().getTime();
var profile = {};
var assertion;
var parsedAssertion;
var parser = new xml2js.Parser(parserConfig);
Q.ninvoke(parser, 'parseString', xml)
.then(function(doc) {
parsedAssertion = doc;
assertion = doc.Assertion;

var issuer = assertion.Issuer;
Expand Down Expand Up @@ -858,7 +860,8 @@ SAML.prototype.processValidlySignedAssertion = function(xml, inResponseTo, callb
}

if (!profile.mail && profile['urn:oid:0.9.2342.19200300.100.1.3']) {
// See http://www.incommonfederation.org/attributesummary.html for definition of attribute OIDs
// See https://spaces.internet2.edu/display/InCFederation/Supported+Attribute+Summary
// for definition of attribute OIDs
profile.mail = profile['urn:oid:0.9.2342.19200300.100.1.3'];
}

Expand All @@ -867,6 +870,7 @@ SAML.prototype.processValidlySignedAssertion = function(xml, inResponseTo, callb
}

profile.getAssertionXml = function() { return xml; };
profile.getAssertion = function() { return parsedAssertion; };

callback(null, profile, false);
})
Expand Down

0 comments on commit faccd89

Please sign in to comment.