vapor / fluent

Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
https://docs.vapor.codes/4.0/fluent/overview/
MIT License
1.32k stars 172 forks source link

sessionAuthenticator ignores databaseID #701

Closed ehpi closed 3 years ago

ehpi commented 4 years ago

The SessionAuthenticatable protocol provides a static sessionAuthenticator() function to which a databaseID can be passed as an optional argument:

let protected = app.grouped(
    app.session.middleware,
    User.sessionAuthenticator(.someDatabase)
)

But this argument is ignored by the DatabaseSessionAuthenticator implementation, which causes an internal server error unless the database in which the User model lives is also the default database.