Skip to content
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

Feature: Add exp to generated user JWTs #35

Open
fullykubed opened this issue Nov 22, 2024 · 3 comments
Open

Feature: Add exp to generated user JWTs #35

fullykubed opened this issue Nov 22, 2024 · 3 comments

Comments

@fullykubed
Copy link

Great plugin!

We'd like to use it to generate temporary credentials for our NATS clusters.

Unfortunately, the JWTs generated by this function do not have the exp set so they are essentially perpetual.

It looks like exp support is already present and just requires being added similar to iss here.

@fullykubed fullykubed changed the title Add exp to generated user JWTs Feature: Add exp to generated user JWTs Nov 22, 2024
@fullykubed
Copy link
Author

Additionally, the expiration time should be checked in the refresh loop so that the stored JWT can be updated before it expires:

if jwtMissing || nkeyMissing {
.

It seems like it would be good to refresh it when it is >= 50% of the way between iat and exp.

@siredmar
Copy link
Member

siredmar commented Nov 25, 2024

You are right. Thanks for reporting this! Token expiration is not implemented as this has not been a use case for us yet.

Since I'm no longer working full time on all these projects, I'll look into this issue when I have some time.

PRs are very welcome though :)

@fullykubed
Copy link
Author

@siredmar Thanks for the confirmation.

We ended up not going with this plugin, otherwise would be happy to add the PR.

For our use case, we didn't need multi-tenancy, just dynamic credentials, and we were able to just use mTLS NATS auth with the Vault PKI backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants