Skip to content
Myr

add deprecation message to req.auth

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 12507cf · Browse files · 3 files+10 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+10 added−12 removed

  • other:+10 added−12 removed

3 files+10 added−12 removed

modified:lib/request.js+7 added-12 removed
1 unmodified line
2/**3 * Module dependencies.4 */56var auth = require('basic-auth');7var deprecate = require('depd')('express');8var http = require('http')9 , utils = require('./utils')10 , connect = require('connect')11 , fresh = require('fresh')
411 unmodified lines
423 * @api public424 */425426req.__defineGetter__('auth', function(){425 // missing426 var auth = this.get('Authorization');427 if (!auth) return;427 deprecate('req.auth: Use basic-auth module directly');428429 // malformed430 var parts = auth.split(' ');431 if ('basic' != parts[0].toLowerCase()) return;432 if (!parts[1]) return;433 auth = parts[1];434429 // credentials436 auth = new Buffer(auth, 'base64').toString().match(/^([^:]*):(.*)$/);437 if (!auth) return;438 return { username: auth[1], password: auth[2] };430 var creds = auth(this);431 if (!creds) return;432433 return { username: creds.name, password: creds.pass };434});435436/**437 * Return subdomains as an array.
112 unmodified lines
modified:History.md+2 added
1unreleased2==========34 * add deprecation message to `app.configure`5 * add deprecation message to `req.auth`6 * use `basic-auth` to parse `Authorization` header7 * deps: connect@2.22.08 - deps: csurf@~1.3.09 - deps: express-session@~1.6.110 - deps: multiparty@3.3.0
1498 unmodified lines
modified:package.json+1 added