()
| 64 | return next() |
| 65 | |
| 66 | function unauthorized() { |
| 67 | if(challenge) { |
| 68 | var challengeString = 'Basic' |
| 69 | var realmName = realm(req) |
| 70 | |
| 71 | if(realmName) |
| 72 | challengeString += ' realm="' + realmName + '"' |
| 73 | |
| 74 | res.set('WWW-Authenticate', challengeString) |
| 75 | } |
| 76 | |
| 77 | //TODO: Allow response body to be JSON (maybe autodetect?) |
| 78 | const response = getResponseBody(req) |
| 79 | |
| 80 | if(typeof response == 'string') |
| 81 | return res.status(401).send(response) |
| 82 | |
| 83 | return res.status(401).json(response) |
| 84 | } |
| 85 | |
| 86 | function authorizerCallback(err, approved) { |
| 87 | assert.ifError(err) |
no outgoing calls
no test coverage detected
searching dependent graphs…