Open 0xTim opened 5 years ago
I think you mean Vapor 4?
Nothing to see here 😆
@0xTim I agree, this is something I've wanted to do. I think we could follow a pattern similar to how Vapor 4 will have separate packages for Fluent
and FluentKit
:
Following that, we could have vapor/auth and vapor/auth-kit. Where vapor/auth provides all the nice default extensions where your authenticable items are also models. That would allow you to theoretically use AuthKit with any ORM.
The other alternative would just be accepting that vapor/auth is an auth layer for Fluent. The win there is less complexity / package bloat.
@tanner0101 yeah an AuthKit and FluentAuth package would make sense. I think accepting vapor/auth as an auth layer for Fluent as it currently stands would be wrong as there's lots of stuff in here that doesn't need Fluent and could be broken out relatively easily with little changes. But splitting them into different packages with no dependency on Fluent would be a big win, especially for things like APIs that don't touch Fluent
It would be great to be able to use the auth package when implementing something like the repository pattern. In SteamPress for Vapor 3, there is no knowledge of Fluent (at least the inner package). All the models are held behind repositories accessible from services. This would be fine, except for the fact things like
BasicAuthenticatable
that all the web sessions stuff relies on useDatabaseConnection
to get the user for verifying. Because it's done in the protocol there's no way to implement the extensions yourself but still conform, meaning you have to reimplement most of the auth package 😞Would be great to be fixed with Vapor 4!