This commit is contained in:
Steffo Weber 2017-07-20 17:44:14 +02:00
parent 2087fe5e94
commit 835cc6fc34
4 changed files with 33 additions and 10 deletions

View file

@ -18,12 +18,14 @@
"debug": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.1.tgz",
"from": "debug@2.6.1"
},
"ms": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
"from": "ms@0.7.2"
"from": "debug@2.6.1",
"dependencies": {
"ms": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
"from": "ms@0.7.2"
}
}
}
}
},

View file

@ -32,7 +32,8 @@ settings = {"saml":[{
"publicCertFile": "certs/mycert.pem", // eg $METEOR-PROJECT/private/certs/mycert.pem
"dynamicProfile": true // set to true if we want to create a user in Meteor.users dynamically if SAML assertion is valid
"identifierFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified", // Defaults to urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
"localProfileMatchAttribute": "telephoneNumber" // CAUTION: this will be mapped to profile.<localProfileMatchAttribute> attribute in Mongo if identifierFormat (see above) differs from urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
"localProfileMatchAttribute": "telephoneNumber" // CAUTION: this will be mapped to profile.<localProfileMatchAttribute> attribute in Mongo if identifierFormat (see above) differs from urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress,
"attributesSAML": {[telephoneNumber, sn, givenName, mail]}, // attrs from SAML attr statement, which will be used for local Meteor profile creation
}]}

View file

@ -1,7 +1,7 @@
Package.describe({
name:"steffo:meteor-accounts-saml",
summary: "SAML Login (SP) for Meteor. Works with OpenAM, OpenIDP and provides Single Logout.",
version: "0.0.12",
version: "0.0.13",
git: "https://github.com/steffow/meteor-accounts-saml.git"
});
@ -23,7 +23,8 @@ Package.onTest((api) => {
Npm.depends({
"depd": "1.1.0",
"xml-crypto": "0.9.0",
"xml-crypto": "0.9.0",
"body-parser": "1.17.1",
"bytes": "2.5.0",
"content-type": "1.0.2",
"debug": "2.6.3",
@ -42,7 +43,6 @@ Npm.depends({
"media-typer": "0.3.0",
"mime-types": "2.1.15",
"xml2js": "0.4.17",
"body-parser": "1.17.1",
"sax": "1.2.2",
"xmlbuilder": "9.0.0",
"ejs": "2.5.6",

View file

@ -121,6 +121,26 @@ Accounts.registerLoginHandler(function(loginRequest) {
user = Meteor.users.findOne({
"username": loginResult.profile.nameID
});
// update user profile w attrs from SAML Attr Satement
//Meteor.user.update(user, )
if (Meteor.settings.debug) {
console.log("Profile for attributes: " + JSON.stringify(loginResult.profile));
}
var attributeNames = Meteor.settings.saml[0].attributesSAML;
var meteorProfile = {};
if (attributeNames) {
attributeNames.forEach(function(attribute) {
meteorProfile[attribute] = loginResult.profile[attribute];
});
}
if (Meteor.settings.debug) {
console.log("Profile for Meteor: " + JSON.stringify(meteorProfile));
}
Meteor.users.update(user, {
$set: {
'profile': meteorProfile
}
});
if (Meteor.settings.debug) {
console.log("Created new user");
}