Repository navigation
Server: Replace passport with Dito.js' own login and session handling - #326
Merged
Merged
Conversation
lehni
force-pushed
the
refactor/remove-passport
branch
5 times, most recently
from
October 16, 2026 23:00
2d19bd9 to
4d77466
Compare
lehni
added this pull request to stack #341
October 16, 2026 23:05
lehni
force-pushed
the
refactor/remove-passport
branch
2 times, most recently
from
October 17, 2026 01:25
f1ee7d4 to
db17729
Compare
- Read login credentials from the request body in UserMixin.login() - Restore session users and define ctx.login(), ctx.logout() and ctx.isAuthenticated() in handleUser(), always installed - Keep the passport.user session key, so existing sessions stay valid - Deprecate app.passport, which has no effect anymore - Drop the koa-passport and passport-local dependencies
lehni
force-pushed
the
refactor/remove-passport
branch
from
October 17, 2026 21:24
db17729 to
4882a80
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #325.
UserMixin.login()checks the credentials of the request body itself, with the same errors as before.handleUser()restores session users and definesctx.login(),ctx.logout(),ctx.isAuthenticated()andctx.isUnauthenticated(), with the login and logout events. It's always installed.passport.userkey, so existing sessions stay valid.app.passportis deprecated and has no effect.koa-passportandpassport-local.Behaviour changes, also in the changelog:
before:loginonly fires for logins that can succeed.UsersControlleronly treats users of its own model class as logged in, not users of sub-classes, which have their own tables and ids.UserMixin.sessionQuery()is internal;sessionScopestill sets the scopes.ctx.req.usermirror and custom Passport strategies through Dito.js are gone.The tests were written against Passport first and pass there, except the one for query-string credentials. They cover restoring sessions in Passport's format, session regeneration on login, logout, scoped and deleted users,
session: false, the events, and transacted logins that fail.