Skip to content

Commit ad5fe1d

Browse files
authored
Merge pull request jaredhanson#501 from danielsharvey/passport-doco-updates
Passport doco updates
2 parents e3e9878 + 9502d99 commit ad5fe1d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/middleware/authenticate.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,31 @@ var http = require('http')
1818
* Options:
1919
* - `session` Save login state in session, defaults to _true_
2020
* - `successRedirect` After successful login, redirect to given URL
21+
* - `successMessage` True to store success message in
22+
* req.session.messages, or a string to use as override
23+
* message for success.
24+
* - `successFlash` True to flash success messages or a string to use as a flash
25+
* message for success (overrides any from the strategy itself).
2126
* - `failureRedirect` After failed login, redirect to given URL
27+
* - `failureMessage` True to store failure message in
28+
* req.session.messages, or a string to use as override
29+
* message for failure.
30+
* - `failureFlash` True to flash failure messages or a string to use as a flash
31+
* message for failures (overrides any from the strategy itself).
2232
* - `assignProperty` Assign the object provided by the verify callback to given property
2333
*
2434
* An optional `callback` can be supplied to allow the application to override
2535
* the default manner in which authentication attempts are handled. The
2636
* callback has the following signature, where `user` will be set to the
2737
* authenticated user on a successful authentication attempt, or `false`
2838
* otherwise. An optional `info` argument will be passed, containing additional
29-
* details provided by the strategy's verify callback.
39+
* details provided by the strategy's verify callback - this could be information about
40+
* a successful authentication or a challenge message for a failed authentication.
41+
* An optional `status` argument will be passed when authentication fails - this could
42+
* be a HTTP response code for a remote authentication failure or similar.
3043
*
3144
* app.get('/protected', function(req, res, next) {
32-
* passport.authenticate('local', function(err, user, info) {
45+
* passport.authenticate('local', function(err, user, info, status) {
3346
* if (err) { return next(err) }
3447
* if (!user) { return res.redirect('/signin') }
3548
* res.redirect('/account');

0 commit comments

Comments
 (0)