Skip to content

Commit

Permalink
[IMPROVE] Add decoding for commonName (cn) and displayName attributes…
Browse files Browse the repository at this point in the history
… for SAML (#12347)
  • Loading branch information
pkolmann authored and sampaiodiego committed Mar 12, 2019
1 parent 44d8492 commit c4bc234
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/meteor-accounts-saml/server/saml_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Accounts.registerLoginHandler(function(loginRequest) {

if (!user) {
const newUser = {
name: loginResult.profile.cn || loginResult.profile.username,
name: loginResult.profile.displayName || loginResult.profile.cn || loginResult.profile.username,
active: true,
globalRoles: ['user'],
emails: emailList.map((email) => ({
Expand Down
9 changes: 9 additions & 0 deletions packages/meteor-accounts-saml/server/saml_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@ SAML.prototype.mapAttributes = function(attributeStatement, profile) {
if (!profile.email && profile.mail) {
profile.email = profile.mail;
}

if (!profile.displayName && profile['urn:oid:2.16.840.1.113730.3.1.241']) {
profile.displayName = profile['urn:oid:2.16.840.1.113730.3.1.241'];
}

if (!profile.cn && profile['urn:oid:2.5.4.3']) {
profile.cn = profile['urn:oid:2.5.4.3'];
}

};

SAML.prototype.validateResponse = function(samlResponse, relayState, callback) {
Expand Down

0 comments on commit c4bc234

Please sign in to comment.