Closed jseibert closed 6 years ago
@jseibert it might be even more flexible to not require Model
on any of the protocols and instead require it in the extensions and middleware that actually rely on Fluent.
@tanner0101 even better! That makes total sense.
@tanner0101 Ok, I just got time to update this. I removed the Model conformance on as many of the protocols as possible. Some, like Session and Token, require it implicitly, so we can't strip it from them.
Interesting, it builds on macOS but not Linux. Looking into it...
@tanner0101 OK, compilation finally works. This is probably the furthest it can be abstracted without significant rewrites to TokenAuthenticatable.
Test are now failing for an unrelated reason, so I'll put the ball back in your court :)
Hey @jseibert, you just merged a pull request, have a coin!
You now have 1 coins.
Vapor's approach to authentication is designed to be flexible, and the ability to authenticate arbitrary classes on each
Request
viatry req.authenticated(T.self)
is powerful.However, there is no logical or technical reason that
Authenticatable
classes must beModel
's. In fact, it's easy to imagine cases (e.g. God roles) where they shouldn't be.This makes that possible.