Skip to content

Proposed fix for challenge / response #489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
27 changes: 27 additions & 0 deletions lib/middleware/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,33 @@ module.exports = function authenticate(passport, name, options, callback) {
res.setHeader('Content-Length', '0');
res.end();
};

/**
* Send raw `data` without indicating pass or fail.
*
* Options:
* - `json` boolean indicating whether data should be sent as JSON, defaults to _false_ which sends data using `res.send()`
* - `type` the `Content-Type` in the HTTP response
* - `status` the HTTP status code to send, defaults to _200_
*
* @param {Object} data
* @param {Object} options
*/
strategy.raw = function (data, options) {
var status = options.status || 200;
var json = options.json || false;
var type = options.type || null;

if (type) {
res.type(type);
}

if (json) {
res.status(status).json(data);
} else {
res.status(status).send(data);
}
};

/**
* Pass without making a success or fail decision.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "passport",
"version": "0.3.2",
"version": "0.3.3",
Copy link

@kohtala kohtala Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is your task to update package.json.

"description": "Simple, unobtrusive authentication for Node.js.",
"keywords": [
"express",
Expand Down