Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/passport-http/strategies/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ BasicStrategy.prototype.authenticate = function(req) {
var parts = authorization.split(' ')
if (parts.length < 2) { return this.fail(400); }

var scheme = parts[0]
, credentials = new Buffer(parts[1], 'base64').toString().split(':');

var scheme = parts[0], credstr = new Buffer(parts[1], 'base64').toString();
if (credstr.indexOf(":") === -1) { return this.fail(400); }
var credentials = [ credstr.substr(0, credstr.indexOf(":")),
credstr.substr(credstr.indexOf(":")+1) ];
if (!/Basic/i.test(scheme)) { return this.fail(this._challenge()); }
if (credentials.length < 2) { return this.fail(400); }

var userid = credentials[0];
var password = credentials[1];
Expand Down