-
Notifications
You must be signed in to change notification settings - Fork 6k
Add JWT Authentication support #9424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Before we add this support, we should assess the implications of this pattern. The initial questions I have are:
I'm curious, is this pattern being used out there today? Which libraries have implemented this? |
Here are some examples: |
The ASP link uses an ASP.NET Core authentication server, so this is not equivalent to the proposed pattern.
AdonisJs acts as an OAuth provider.
ktor acts as an OAuth provider. All 3 act as OAuth providers (Authorization Server's) so they are not equivalent to the proposed pattern. |
Well ktor is one that I used personally without oauth and just plain jwt. So not it doesn't and I know so for sure.
There's no reference at all to a As for Adonis, I have an application deployed that uses JWT, also with out oauth at all. |
The links you provided for ktor and Adonis both don't have anything to do with the JWT feature at all. Ktor does also support oauth in parallel to plain JWT and the Adonis link doesn't even mention oauth at all. |
This is by the way just a reference to it using dependency injection (provider != OAuth provider) |
The application has the private key in this case, so the public key can be derived from that.
That can usually be configured by the developer in what I have seen.
With the implementations I've seen no, except ASP.NET if I remember correctly.
I think this was determined by the developers in most cases I've seen.
For this I only know what ktor provides and in that case you verify the JWT yourself, so you'd have to implement it yourself, but that'd be a nice addition I guess. |
@cromefire Let me restate my viewpoint on this ticket and hopefully this will clarify things. This ticket essentially proposes a Security Token Service (STS) from a conceptual design standpoint. At a bare minimum, an STS must provide the capability of revoking a token and verifying a token. If it can mint a token then it should also be able to revoke and verify a token. However, a production-ready STS will deliver much more security features on top of this minimum. An STS is a security provider and you can consider OAuth / OIDC as specialized versions of an STS. The main advantage to using an OAuth 2.0 and/or OpenID Connect 1.0 provider is they are implemented to industry standards and therefore allow for interoperability and provide implementation (security) recommendations to protect against attacks. When I read the issue comment:
This looks very similar to the Resource Owner Password Credentials Grant. NOTE: This is deprecated in OAuth 2.1 We need to be careful that we don't reinvent the wheel and provide a proprietary solution. |
Well it's from the standpoint of spring security basically just an API token that is verified using a public key (a characteristic that's good for HA for example without the need of a storage backend). To my knowledge none of the implementations listed above are providing capabilities to revoke tokens. To combat the issues with revoking tokens I've often seen a combination of refresh tokens and short expiry dates
It's a feature provided by seemingly every major framework that provides authentication, so I guess it's a little too late. Your alternative to use oidc has basically 3 major Design flaws (opposed to JWT or API Token authentication):
This makes oidc a totally different complexity and use case from plain JWT auth, which is just a more specific implementation of API tokens. |
Woooo... JWT is already supported in the current version |
Can you elaborate on that? |
I recommend you to check out the JWT doc here. I use version 5.2.5 of Spring Security Reactive Talk is cheap. Show you the code.
|
Yes that can be used sort of as a workaround, but it's not quite a "proper" solution I think (although it shows the internals are already there) See #9423 |
fine |
Looking at the code it seems like everything is pretty much in place and the only thing needed would be some simple API to make it easy and keep you from needing to spend a lot of time to figure it out. Seems like basically one method to me (if at all) plus a guide or something to get people started and maybe something to generate the tokens (I not very deep into spring security, so it might just need some docs). |
Yes, it is indeed a bit complicated, custom processing needs to look at some internal logic, which may not be friendly. |
It would be nice if Spring Security supported REST APIs issuing self-signed JWTs.
One use case that is quite common is for a REST API to first exchange a username and password for a JWT. That JWT is then used to authenticate subsequent requests.
The text was updated successfully, but these errors were encountered: