passport-oauthkermit
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -296,3 +296,2 @@ /** | ||
/** | ||
@@ -299,0 +298,0 @@ * Expose `OAuthStrategy`. |
@@ -59,2 +59,4 @@ /** | ||
function OAuth2Strategy(options, verify) { | ||
console.log('passport-oauthkermit:OAuth2Strategy options'+options+' verify'+verify); | ||
options = options || {} | ||
@@ -87,2 +89,8 @@ passport.Strategy.call(this); | ||
this._skipUserProfile = (options.skipUserProfile === undefined) ? false : options.skipUserProfile; | ||
console.log('passport-oauthkermit:OAuth2Strategy _callbackURL='+options.callbackURL); | ||
console.log('passport-oauthkermit:OAuth2Strategy _scope='+options.scope); | ||
console.log('passport-oauthkermit:OAuth2Strategy this._scopeSeparator='+this._scopeSeparator); | ||
console.log('passport-oauthkermit:OAuth2Strategy this._passReqToCallback='+this._passReqToCallback); | ||
console.log('passport-oauthkermit:OAuth2Strategy this._skipUserProfile='+this._skipUserProfile); | ||
} | ||
@@ -103,2 +111,3 @@ | ||
OAuth2Strategy.prototype.authenticate = function(req, options) { | ||
console.log('passport-oauthkermit:authenticate'); | ||
options = options || {}; | ||
@@ -108,4 +117,3 @@ var self = this; | ||
if (req.query && req.query.error) { | ||
console.log('passport-oauthkermit/lib/passport-oauth/strategies/oauth2.js/OAuth2Strategy.prototype.authenticate'); | ||
console.log('req.query error='+req.query.error); | ||
console.log('passport-oauthkermit:authenticate req.query error='+req.query.error); | ||
// TODO: Error information pertaining to OAuth 2.0 flows is encoded in the | ||
@@ -131,4 +139,6 @@ // query parameters, and should be propagated to the application. | ||
var code = req.query.code; | ||
// NOTE: The module oauth (0.9.5), which is a dependency, automatically adds | ||
console.log('passport-oauthkermit: code'+code); | ||
// NOTE: The module oauth (0.9.5), which is a dependency, automatically adds | ||
// a 'type=web_server' parameter to the percent-encoded data sent in | ||
@@ -154,5 +164,14 @@ // the body of the access token request. This appears to be an | ||
self._loadUserProfile(accessToken, function(err, profile) { | ||
if (err) { return self.error(err); }; | ||
console.log('passport-oauthkermit: retour _loadUserProfile'); | ||
if (err) { | ||
console.log('passport-oauthkermit: err = '+err); | ||
return self.error(err); | ||
}; | ||
function verified(err, user, info) { | ||
console.log('passport-oauthkermit:verified err = '+err); | ||
console.log('passport-oauthkermit:verified user = '+user); | ||
console.log('passport-oauthkermit:verified info = '+info); | ||
if (err) { return self.error(err); } | ||
@@ -164,13 +183,23 @@ if (!user) { return self.fail(info); } | ||
if (self._passReqToCallback) { | ||
console.log('passport-oauthkermit:verified _passReqToCallback'); | ||
var arity = self._verify.length; | ||
if (arity == 6) { | ||
self._verify(req, accessToken, refreshToken, params, profile, verified); | ||
console.log('passport-oauthkermit:verified _passReqToCallback arity=6'); | ||
self._verify(req, accessToken, refreshToken, params, profile, verified); | ||
} else { // arity == 5 | ||
console.log('passport-oauthkermit:verified _passReqToCallback arity=5'); | ||
self._verify(req, accessToken, refreshToken, profile, verified); | ||
} | ||
} else { | ||
var arity = self._verify.length; | ||
if (arity == 5) { | ||
self._verify(accessToken, refreshToken, params, profile, verified); | ||
console.log('passport-oauthkermit:verified _passReqToCallback arity=5 bis'); | ||
self._verify(accessToken, refreshToken, params, profile, verified); | ||
} else { // arity == 4 | ||
console.log('passport-oauthkermit:verified _passReqToCallback arity=4'); | ||
self._verify(accessToken, refreshToken, profile, verified); | ||
@@ -183,3 +212,6 @@ } | ||
} else { | ||
// NOTE: The module oauth (0.9.5), which is a dependency, automatically adds | ||
console.log('passport-oauthkermit: dans le else global'); | ||
// NOTE: The module oauth (0.9.5), which is a dependency, automatically adds | ||
// a 'type=web_server' parameter to the query portion of the URL. | ||
@@ -202,2 +234,5 @@ // This appears to be an artifact from an earlier draft of OAuth 2.0 | ||
var location = this._oauth2.getAuthorizeUrl(params); | ||
console.log('passport-oauthkermit: dans le else global location='+location); | ||
this.redirect(location); | ||
@@ -220,3 +255,4 @@ } | ||
OAuth2Strategy.prototype.userProfile = function(accessToken, done) { | ||
return done(null, {}); | ||
console.log('passport-oauthkermit:userProfile'); | ||
return done(null, {}); | ||
} | ||
@@ -238,2 +274,3 @@ | ||
OAuth2Strategy.prototype.authorizationParams = function(options) { | ||
console.log('passport-oauthkermit:authorizationParams'); | ||
return {}; | ||
@@ -250,8 +287,12 @@ } | ||
OAuth2Strategy.prototype._loadUserProfile = function(accessToken, done) { | ||
console.log('passport-oauthkermit:_loadUserProfile'); | ||
var self = this; | ||
function loadIt() { | ||
console.log('passport-oauthkermit:loadIt'); | ||
return self.userProfile(accessToken, done); | ||
} | ||
function skipIt() { | ||
console.log('passport-oauthkermit:skipIt'); | ||
return done(null); | ||
@@ -263,3 +304,6 @@ } | ||
this._skipUserProfile(accessToken, function(err, skip) { | ||
if (err) { return done(err); } | ||
if (err) { | ||
console.log('passport-oauthkermit:skipIt err='+err); | ||
return done(err); | ||
} | ||
if (!skip) { return loadIt(); } | ||
@@ -266,0 +310,0 @@ return skipIt(); |
{ | ||
"name": "passport-oauthkermit", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "passport-oauth for kermit", | ||
@@ -20,3 +20,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"oauthkermit": "0.0.3", | ||
"oauthkermit": "0.0.4", | ||
"passport": "^0.2.1", | ||
@@ -23,0 +23,0 @@ "pkginfo": "^0.3.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
63354
16
636
+ Addedoauthkermit@0.0.4(transitive)
- Removedoauthkermit@0.0.3(transitive)
Updatedoauthkermit@0.0.4