Merge pull request #1 from GeographicaGS/dev_raul_oidc

Dev raul oidc
This commit is contained in:
Raúl Yeguas 2014-12-11 22:04:42 +01:00
commit f48592e2fd

View file

@ -29,19 +29,25 @@
path: meta.config['sso:saml:callbackpath'], path: meta.config['sso:saml:callbackpath'],
entryPoint: meta.config['sso:saml:idpentrypoint'], entryPoint: meta.config['sso:saml:idpentrypoint'],
issuer: meta.config['sso:saml:issuer'], issuer: meta.config['sso:saml:issuer'],
callbackUrl: nconf.get('url') + meta.config['sso:saml:callbackpath'] callbackUrl: nconf.get('url') + meta.config['sso:saml:callbackpath'],
disableRequestedAuthnContext: true,
identifierFormat: null
}, },
function(profile, done) { function(profile, done) {
console.log(profile);
var user = { var user = {
nameID: profile.nameID, nameID: profile.nameID,
nameIDFormat: profile.nameIDFormat, nameIDFormat: profile.nameIDFormat,
sn: profile.sn, sn: profile['urn:oid:2.5.4.4'], // sn
cn: profile.cn, //sn: profile.sn,
mail: profile.mail, cn: profile['urn:oid:2.5.4.42'], // givenname
eduPersonAffiliation: profile.eduPersonAffiliation, //cn: profile.cn,
email: profile.email, //mail: profile.mail,
username: profile.eduPersonNickname //eduPersonAffiliation: profile.eduPersonAffiliation,
email: profile.mail,
//email: profile.email,
username: profile['urn:oid:1.3.6.1.4.1.5923.1.1.1.2'], // eduPersonNickname
//username: profile.eduPersonNickname
}; };
SAML.login(user,function(err, user) { SAML.login(user,function(err, user) {
@ -156,12 +162,12 @@
}); });
} }
else { else {
console.log(userdata);
// New User // New User
user.create({ user.create({
username: userdata.username, username: userdata.username,
email: userdata.email, email: userdata.email,
fullname : userdata.cn + " " + userdata.sn fullname : userdata.first_name + " " + userdata.last_name
}, function(err, uid) { }, function(err, uid) {
if(err) { if(err) {