Skip to content

Commit

Permalink
Delint.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Aug 2, 2013
1 parent 8fbbab2 commit bb65eff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SOURCES = lib/**/*.js
SOURCES = lib/*.js
TESTS ?= test/*.test.js

lint: lint-jshint
Expand Down
25 changes: 12 additions & 13 deletions lib/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function Strategy(options, verify) {
verify = options;
options = {};
}
if (!verify) throw new TypeError('passport-http-bearer.Strategy requires a verify callback');
if (!verify) { throw new TypeError('passport-http-bearer.Strategy requires a verify callback'); }

passport.Strategy.call(this);
this.name = 'bearer';
Expand All @@ -86,8 +86,8 @@ util.inherits(Strategy, passport.Strategy);
Strategy.prototype.authenticate = function(req) {
var token;

if (req.headers && req.headers['authorization']) {
var parts = req.headers['authorization'].split(' ');
if (req.headers && req.headers.authorization) {
var parts = req.headers.authorization.split(' ');
if (parts.length == 2) {
var scheme = parts[0]
, credentials = parts[1];
Expand All @@ -100,14 +100,14 @@ Strategy.prototype.authenticate = function(req) {
}
}

if (req.body && req.body['access_token']) {
if (req.body && req.body.access_token) {
if (token) { return this.fail(400); }
token = req.body['access_token'];
token = req.body.access_token;
}

if (req.query && req.query['access_token']) {
if (req.query && req.query.access_token) {
if (token) { return this.fail(400); }
token = req.query['access_token'];
token = req.query.access_token;
}

if (!token) { return this.fail(this._challenge()); }
Expand All @@ -118,15 +118,14 @@ Strategy.prototype.authenticate = function(req) {
if (err) { return self.error(err); }
if (!user) { return self.fail(self._challenge('invalid_token')); }
self.success(user, info);
}
}

if (self._passReqToCallback) {
this._verify(req, token, verified);
} else {
this._verify(token, verified);
}

}
}
};

/**
* Build authentication challenge.
Expand All @@ -149,10 +148,10 @@ Strategy.prototype._challenge = function(code, desc, uri) {
}

return challenge;
}
};


/**
* Expose `Strategy`.
*/
*/
module.exports = Strategy;
2 changes: 1 addition & 1 deletion test/strategy.default.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('strategy with default options', function() {
});
});

describe('handling a request with valid credential in URL query', function() {
describe('handling a request with valid credential in URL query parameter', function() {
var user
, info;

Expand Down

0 comments on commit bb65eff

Please sign in to comment.