Comparing version
@@ -34,2 +34,6 @@ module.exports = { | ||
} | ||
, googlehybrid: { | ||
consumerKey: 'YOUR CONSUMER KEY HERE' | ||
, consumerSecret: 'YOUR CONSUMER SECRET HERE' | ||
} | ||
, _37signals: { | ||
@@ -82,2 +86,7 @@ clientId: 'cd4bf9cd9ed828b6bed8b67e6b314cf8b90c8de5' | ||
} | ||
, evernote: { | ||
oauthHost: 'https://www.evernote.com' | ||
, consumerKey: 'Enter your consumer key here' | ||
, consumerSecret: 'Enter your consumer secret here' | ||
} | ||
}; |
@@ -45,2 +45,4 @@ var express = require('express') | ||
var usersBySkyrockId = {}; | ||
var usersByEvernoteId = {}; | ||
var usersByAzureAcs = {}; | ||
var usersByLogin = { | ||
@@ -55,2 +57,15 @@ 'brian@example.com': addUser({ login: 'brian@example.com', password: 'password'}) | ||
everyauth.azureacs | ||
.identityProviderUrl('https://acssample1.accesscontrol.windows.net/v2/wsfederation/') | ||
.entryPath('/auth/azureacs') | ||
.callbackPath('/auth/azureacs/callback') | ||
.signingKey('d0julb9JNbCB8J2ACHzxU33SSiqbylQveQtuwOEvz24=') | ||
.realm('urn:nodeacslocal') | ||
.homeRealm('') | ||
.tokenFormat('swt') | ||
.findOrCreateUser( function (session, acsUser) { | ||
return usersByAzureAcs[acsUser.id] || (usersByAzureAcs[acsUser.id] = addUser('azureAcs', acsUser)); | ||
}) | ||
.redirectPath('/'); | ||
everyauth | ||
@@ -222,4 +237,5 @@ .openid | ||
everyauth.googlehybrid | ||
.consumerKey(conf.google.clientId) | ||
.consumerSecret(conf.google.clientSecret) | ||
.myHostname('http://local.host:3000') | ||
.consumerKey(conf.googlehybrid.consumerKey) | ||
.consumerSecret(conf.googlehybrid.consumerSecret) | ||
.scope(['http://docs.google.com/feeds/','http://spreadsheets.google.com/feeds/']) | ||
@@ -229,3 +245,3 @@ .findOrCreateUser( function(session, userAttributes) { | ||
}) | ||
.redirectPath('/') | ||
.redirectPath('/'); | ||
@@ -320,5 +336,15 @@ everyauth.readability | ||
everyauth.evernote | ||
.oauthHost(conf.evernote.oauthHost) | ||
.consumerKey(conf.evernote.consumerKey) | ||
.consumerSecret(conf.evernote.consumerSecret) | ||
.findOrCreateUser( function (sess, accessToken, accessTokenExtra, enUserMetadata) { | ||
return usersByEvernoteId[enUserMetadata.userId] || (usersByEvernoteId[enUserMetadata.userId] = addUser('evernote', enUserMetadata)); | ||
}) | ||
.redirectPath('/'); | ||
var app = express.createServer( | ||
express.bodyParser() | ||
, express.static(__dirname + "/public") | ||
, express.favicon() | ||
, express.cookieParser() | ||
@@ -325,0 +351,0 @@ , express.session({ secret: 'htuayreve'}) |
@@ -1,30 +0,31 @@ | ||
module.exports = function (app) { | ||
var everyauth = this; | ||
app.dynamicHelpers({ | ||
everyauth: function (req, res) { | ||
var ea = {} | ||
, sess = req.session; | ||
ea.loggedIn = sess.auth && !!sess.auth.loggedIn; | ||
module.exports = function (app, opts) { | ||
var everyauth = this | ||
, helpers = {} | ||
, userAlias = opts && opts.userAlias || 'user'; | ||
helpers.everyauth = function (req, res) { | ||
var ea = {} | ||
, sess = req.session; | ||
ea.loggedIn = sess.auth && !!sess.auth.loggedIn; | ||
// Copy the session.auth properties over | ||
var auth = sess.auth; | ||
for (var k in auth) { | ||
ea[k] = auth[k]; | ||
} | ||
// Copy the session.auth properties over | ||
var auth = sess.auth; | ||
for (var k in auth) { | ||
ea[k] = auth[k]; | ||
} | ||
// Add in access to loginFormFieldName() and passwordFormFieldName() | ||
// TODO Don't compute this if we | ||
// aren't using password module | ||
ea.password || (ea.password = {}); | ||
ea.password.loginFormFieldName = everyauth.password.loginFormFieldName(); | ||
ea.password.passwordFormFieldName = everyauth.password.passwordFormFieldName(); | ||
// Add in access to loginFormFieldName() and passwordFormFieldName() | ||
// TODO Don't compute this if we | ||
// aren't using password module | ||
ea.password || (ea.password = {}); | ||
ea.password.loginFormFieldName = everyauth.password.loginFormFieldName(); | ||
ea.password.passwordFormFieldName = everyauth.password.passwordFormFieldName(); | ||
ea.user = req.user; | ||
ea.user = req.user; | ||
return ea; | ||
} | ||
, user: function (req, res) { | ||
return req.user; | ||
} | ||
}); | ||
return ea; | ||
}; | ||
helpers[userAlias] = function (req, res) { | ||
return req.user; | ||
}; | ||
app.dynamicHelpers(helpers); | ||
}; |
@@ -352,3 +352,7 @@ var url = require('url') | ||
everyModule.moduleErrback( function (err) { | ||
if (! (err instanceof Error)) { | ||
console.log('Warning: Try to pass only Errors'); | ||
err = new Error(JSON.stringify(err)); | ||
} | ||
throw err; | ||
}); |
@@ -52,1 +52,8 @@ var oauthModule = require('./oauth2') | ||
}); | ||
fb.mobile = function (isMobile) { | ||
if (isMobile) { | ||
this.authPath('https://m.facebook.com/dialog/oauth'); | ||
} | ||
return this; | ||
}; |
@@ -10,32 +10,32 @@ var openidModule = require('./openid') | ||
scope: 'array of desired google api scopes' | ||
, consumerKey: 'consumerKey' | ||
, consumerSecret: 'consumerSecret' | ||
, consumerKey: 'Consumer Key' | ||
, consumerSecret: 'Consumer Secret' | ||
}) | ||
.definit( function () { | ||
this.relyingParty = new oid.RelyingParty(this.myHostname() + this.callbackPath(), null, false, false, [ | ||
new oid.AttributeExchange({ | ||
"http://axschema.org/contact/email": "required", | ||
"http://axschema.org/namePerson/first": "required", | ||
"http://axschema.org/namePerson/last": "required" | ||
}), | ||
new oid.OAuthHybrid({ | ||
'consumerKey' : this.consumerKey(), | ||
'scope' : this.scope().join('+') | ||
}) | ||
]); | ||
this.oa = new OAuth( | ||
"https://www.google.com/accounts/OAuthGetRequestToken", | ||
"https://www.google.com/accounts/OAuthGetAccessToken", | ||
this.consumerKey(), | ||
this.consumerSecret(), | ||
"1.0", null, "HMAC-SHA1"); | ||
this.relyingParty = | ||
new oid.RelyingParty(this._myHostname + this._callbackPath, null, false, false, [ | ||
new oid.AttributeExchange({ | ||
'http://axschema.org/contact/email': 'required' | ||
, 'http://axschema.org/namePerson/first': 'required' | ||
, 'http://axschema.org/namePerson/last': 'required' | ||
}) | ||
, new oid.OAuthHybrid({ | ||
consumerKey: this._consumerKey | ||
, scope: this._scope.join('+') | ||
}) | ||
]); | ||
this.oauth = new OAuth( | ||
'https://www.google.com/accounts/OAuthGetRequestToken' | ||
, 'https://www.google.com/accounts/OAuthGetAccessToken' | ||
, this._consumerKey | ||
, this._consumerSecret | ||
, "1.0", null, "HMAC-SHA1"); | ||
}) | ||
.verifyAttributes(function (req,res) { | ||
var p = this.Promise() | ||
oa = this.oa; | ||
oauth = this.oauth; | ||
this.relyingParty.verifyAssertion(req, function (err, userAttributes) { | ||
if(err) return p.fail(err); | ||
console.log(userAttributes); | ||
oa.getOAuthAccessToken(userAttributes['request_token'], undefined, function (err, oauthAccessToken, oauthAccessTokenSecret) { | ||
oauth.getOAuthAccessToken(userAttributes['request_token'], undefined, function (err, oauthAccessToken, oauthAccessTokenSecret) { | ||
if (err) return p.fail(err); | ||
@@ -46,3 +46,2 @@ userAttributes['access_token'] = oauthAccessToken; | ||
}); | ||
}); | ||
@@ -59,4 +58,3 @@ return p; | ||
this.relyingParty.authenticate('http://www.google.com/accounts/o8/id', false, function (err,authenticationUrl){ | ||
if(err) return p.fail(err); | ||
if(err) return p.fail(err); | ||
res.writeHead(302, { Location: authenticationUrl }); | ||
@@ -63,0 +61,0 @@ res.end(); |
@@ -25,3 +25,3 @@ var oauthModule = require('./oauth') | ||
.requestTokenPath('/uas/oauth/requestToken') | ||
.authorizePath('/uas/oauth/authorize') | ||
.authorizePath('/uas/oauth/authenticate') | ||
.accessTokenPath('/uas/oauth/accessToken') | ||
@@ -28,0 +28,0 @@ |
@@ -18,9 +18,9 @@ var everyModule = require('./everymodule') | ||
this.relyingParty = new oid.RelyingParty(this.myHostname() + this.callbackPath(), null, false, false, [ | ||
new oid.UserInterface() | ||
, new oid.SimpleRegistration(this.simpleRegistration()) | ||
, new oid.AttributeExchange(this.attributeExchange()) | ||
]); | ||
}) | ||
.get('entryPath', | ||
'the link a user follows, whereupon you kick off the OpenId auth process - e.g., "/auth/openid"') | ||
new oid.UserInterface() | ||
, new oid.SimpleRegistration(this.simpleRegistration()) | ||
, new oid.AttributeExchange(this.attributeExchange()) | ||
]); | ||
}) | ||
.get('entryPath', | ||
'the link a user follows, whereupon you kick off the OpenId auth process - e.g., "/auth/openid"') | ||
.step('sendToAuthenticationUri') | ||
@@ -30,4 +30,4 @@ .description('sends the user to the providers openid authUrl') | ||
.promises(null) | ||
.get('callbackPath', | ||
'the callback path that the 3rd party Openid provider redirects to after an authorization result - e.g., "/auth/openid/callback"') | ||
.get('callbackPath', | ||
'the callback path that the 3rd party Openid provider redirects to after an authorization result - e.g., "/auth/openid/callback"') | ||
.step('verifyAttributes') | ||
@@ -60,3 +60,2 @@ .description('verifies the return attributes') | ||
res.end(); | ||
}); | ||
@@ -63,0 +62,0 @@ }) |
@@ -1,2 +0,2 @@ | ||
tls = require('tls'); | ||
var tls = require('tls'); | ||
@@ -3,0 +3,0 @@ var clone = exports.clone = function clone (obj) { |
{ | ||
"name": "everyauth", | ||
"description": "Auth solution (password, facebook, & more) for your node.js Connect & Express apps", | ||
"version": "0.2.28", | ||
"version": "0.2.29", | ||
"homepage": "https://github.com/bnoguchi/everyauth/", | ||
@@ -34,3 +34,5 @@ "repository": { | ||
"openid": ">=0.2.0", | ||
"xml2js": ">=0.1.7" | ||
"xml2js": ">=0.1.7", | ||
"node-swt": ">=0.1.1", | ||
"node-wsfederation": ">=0.1.1" | ||
}, | ||
@@ -37,0 +39,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
242116
6.73%72
4.35%3310
6.57%2171
7.1%8
33.33%+ Added
+ Added
+ Added
+ Added