jaredhanson / passport-http

HTTP Basic and Digest authentication strategies for Passport and Node.js.

Home Page:https://www.passportjs.org/packages/passport-http/?utm_source=github&utm_medium=referral&utm_campaign=passport-http&utm_content=about

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User not logged-out when trying to log-in with incorrect password (BasicStrategy)

emilis opened this issue · comments

Steps to reproduce:

  • have a route that requires BasicStrategy and uses session (e.g. /api/login),
  • have a second route (with no authenticate()) that outputs user information from request.user (from session), e.g.: /api/me.
  • log-in using the first route
  • check that you get user information from the second route
  • log-in with incorrect password using the first route
  • you get a 401 / Unauthorized status
  • check the second route: you still get user information from the second route.

Expected result:

  • User is logged-out and one does not get user information from the second route.

I am not sure if this is a bug of BasicStrategy or a "feature" of Passport.js, but I think users should be forcefully logged out when trying to double-login with incorrect credentials.