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

No method to return all claims. #132

Closed
ShramikGajlekar opened this issue Feb 8, 2020 · 5 comments · Fixed by #138
Closed

No method to return all claims. #132

ShramikGajlekar opened this issue Feb 8, 2020 · 5 comments · Fixed by #138

Comments

@ShramikGajlekar
Copy link

For refreshing token, we use all the claims from previous tokens and modify the iat and exp claims. If we have several claims, it's painful to extract all claims from the token and sign a new one.

@lestrrat
Copy link
Collaborator

lestrrat commented Feb 18, 2020

PR #135 implements Claims() to return an iterator, Walk() to examine each pair from the iterator, and AsMap() to generate a map[string]interface{}. If you could check it, that would be great. And if this works for you, I will merge it.

@lestrrat
Copy link
Collaborator

I botched this PR thinking I was in a different branch. Need to redo the PR :/

@lestrrat
Copy link
Collaborator

Whew, I salvaged it from my git history. #138 should do it.

@ShramikGajlekar FYI I'm going to merge this when I wake up tomorrow, which is about 12 hours from now

@ShramikGajlekar
Copy link
Author

I think this would resolve the issue. Thanks for the resolution. Most of the applications requires to copy all claims to sign a new one from the older token, this would help us all a lot :)

lestrrat added a commit that referenced this issue Feb 25, 2020
@lestrrat
Copy link
Collaborator

@ShramikGajlekar just FYI, after fooling around with jws and jwe packages I needed to change the iterator pattern in jwt. You still have AsMap, but if you are using the iterators, their usage will change slightly in the near future.

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