Skip to content

Commit 831940d

Browse files
committed
Reinitialize req.login, etc from initialize middleware.
1 parent e1e4e1f commit 831940d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/middleware/initialize.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ module.exports = function initialize(passport, options) {
4949
options = options || {};
5050

5151
return function initialize(req, res, next) {
52+
req.login =
53+
req.logIn = req.logIn || IncomingMessageExt.logIn;
54+
req.logout =
55+
req.logOut = req.logOut || IncomingMessageExt.logOut;
56+
req.isAuthenticated = req.isAuthenticated || IncomingMessageExt.isAuthenticated;
57+
req.isUnauthenticated = req.isUnauthenticated || IncomingMessageExt.isUnauthenticated;
58+
59+
req._sessionManager = passport._sm;
60+
5261
if (options.userProperty) {
5362
req._userProperty = options.userProperty;
5463
}

0 commit comments

Comments
 (0)