Closed tanner0101 closed 5 years ago
I disagree with this - it pulls in yet another dependency that a large number of people wouldn't use. People on web won't use JWT and I personally don't like it for doing API auth either - JWT is pretty terrible for authenticating users, since you can't blacklist tokens or sign users out etc.
My (highly opinionated) $0.02 😆
Not so sure about the "can't blacklist tokens" and "sign users out" parts of your argument -- a "normal" implementation of JWT is that you use a short-lived token (typically a few minutes at most), with a database-backed "refresh token", and if the latter is revoked then you won't be able to get a new JWT token without logging in again. So you have been effectively signed out / blacklisted.
That said, the middleware should probably be added to the JWT package and not to the Auth one?
Vapor
is not necessarily a dependency on vapor/jwt
nor is Authentication
.
It would make more sense to have another package vapor/auth-jwt
which depends from:
vapor/auth
vapor/jwt
This new repository essentially would be a Vapor 3 version of vapor-community/jwt-provider
which has been deprecated leaving everyone that was using it absolutely without an alternative.
This provides a similar functionality to the old vapor-community/jwt-provider
: https://github.com/asensei/vapor-auth-jwt
Closing due to inactivity - feel free to reopen!
Providing a JWT auth middleware by default could be a nice addition to this package. Vapor's JWT package would be a lightweight dep since Auth already relies on Crypto.