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

Rotated secrets always triggers a new secret to be generated #107

Closed
ChoffaH opened this issue Mar 22, 2021 · 3 comments
Closed

Rotated secrets always triggers a new secret to be generated #107

ChoffaH opened this issue Mar 22, 2021 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ChoffaH
Copy link
Contributor

ChoffaH commented Mar 22, 2021

What version of Go are you using (go version)?

$ go version
1.16

Does this issue reproduce with the latest release?

Yes

What version of Go-Guardian are you using ?

Go-Guardian Version: 
v2.11.3

What did you do?

Trying to get rotated secrets working and have been looking at https://play.golang.org/p/5N-5fWa0mfN (posted by @shaj13) for some help. This is also found somewhere in the examples but can't find it right now.

The issue is that jwt.SecretsKeeper's methods Get and KID doesn't use pointers in it's signature definitions so changes to r.LastRotation in KID is not saved to the keeper struct.

For example this func (r RotatedSecrets) KID() string should be this func (r *RotatedSecrets) KID() string?

What did you expect to see?

That time.Now().After(r.LastRotation) would be false if within specified rotation duration.

What did you see instead?

That time.Now().After(r.LastRotation) is always true as r.LastRotation is always 0.

@shaj13 shaj13 added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Mar 31, 2021
@shaj13
Copy link
Owner

shaj13 commented Apr 24, 2021

@briwagner if you still looking to contribute, I'd love to see a PR.

@briwagner
Copy link
Contributor

Finally got around to this. I had to build out the example with a couple of requests in order to understand what is happening. But makes sense to me now.

PR: #110

@ChoffaH
Copy link
Contributor Author

ChoffaH commented Sep 14, 2021

Great work! 😃

@ChoffaH ChoffaH closed this as completed Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants