lib/passport-http/strategies/basic.js
function BasicStrategy(options, verify) {
  if (typeof options == 'function') {
    verify = options;
    options = {};
  }
  if (!verify) throw new Error('HTTP Basic authentication strategy requires a verify function');
  
  passport.Strategy.call(this);
  this.name = 'basic';
  this._verify = verify;
  this._realm = options.realm || 'Users';
  this._passReqToCallback = options.passReqToCallback;
}
function BasicStrategy(options, verify) {
  if (typeof options == 'function') {
    verify = options;
    options = {};
  }
  if (!verify) throw new Error('HTTP Basic authentication strategy requires a verify function');
  
  passport.Strategy.call(this);
  this.name = 'basic';
  this._verify = verify;
  this._realm = options.realm || 'Users';
  this._passReqToCallback = options.passReqToCallback;
}
function BasicStrategy ( options , verify ) { if ( typeof options == 'function' ) { verify = options ; options = { } ; } if ( ! verify ) throw new Error ( 'HTTP Basic authentication strategy requires a verify function' ) ; passport . Strategy . call ( this ) ; this . name = 'basic' ; this . _verify = verify ; this . _realm = options . realm || 'Users' ; this . _passReqToCallback = options . passReqToCallback ; }
`BasicStrategy` constructor.

The HTTP Basic authentication strategy authenticates requests based on
userid and password credentials contained in the `Authorization` header
field.

Applications must supply a `verify` callback which accepts `userid` and
`password` credentials, and then calls the `done` callback supplying a
`user`, which should be set to `false` if the credentials are not valid.
If an exception occured, `err` should be set.

Optionally, `options` can be used to change the authentication realm.

Options:
- `realm`  authentication realm, defaults to "Users"

Examples:

passport.use(new BasicStrategy(
function(userid, password, done) {
User.findOne({ username: userid, password: password }, function (err, user) {
done(err, user);
});
}
));

For further details on HTTP Basic authentication, refer to [RFC 2617: HTTP Authentication: Basic and Digest Access Authentication](http://tools.ietf.org/html/rfc2617)

@param {Object} options
@param {Function} verify
@api public
BasicStrategy constructor .