HTTP digest on router
gawen opened this issue · comments
Hello,
I am unable to apply a DigestStrategy
to a route defined in a express' Router
.
Here's the following snippet. Note the variable use_router
.
var handler = function(req, res) {
res.json({"hello": "world"});
};
if (use_router) {
var router = express.Router();
router.get('/', passport.authenticate('digest', {session: false}), handler);
app.use("/hello", router);
} else {
app.get('/hello', passport.authenticate('digest', {session: false}), handler);
}
I expected to received {"hello": "world"}
if I GET
on /hello
the right username (any value) and password ("password"
).
curl -v --user user:password --digest http://localhost:8888/hello
It does when use_router
is false
, BUT it does not when use_router
is true
.
I would expect aaplying a DigestStrategy
to a route registered in a router to work, but it appears it does not.
Used versions:
- express: "^4.14.0"
- passport: "^0.3.2"
- passport-http: "^0.3.0"