Skip to content

Conversation

lonelycode
Copy link

I don't expect this to be merged, but some of these commits might help... we've been using this a lot and discovered that it is not concurrency safe and so have added some mutexes.

Also worth noting is there is a bug which caused the JWK to always be refreshed which is now fixed.

Because type assertions are used quite liberally there's a lot of places panics can occur when a map read doesn't turn out as expected - have tried to address the one that's been causing the most headaches.

Oh, and this uses JWT-go v3

:-)

@emanoelxavier
Copy link
Owner

emanoelxavier commented Aug 17, 2016

Thanks for sending this in Martin. I have been meaning to fix some of these issues (jwt v3, concurrency, ...) and haven't got around that. I am glad somebody did :). I will review all the changes and merge them. Will let you know if I have any question on gitter, stay tuned. Thanks for using and contributing back.

@emanoelxavier
Copy link
Owner

I will be merging/tackling these changes piece by piece. I have just handled the changes needed for jwt 3.0.

@@ -70,8 +76,7 @@ func (s *signingKeyProvider) getSigningKey(issuer string, kid string) (interface
}

func findKey(km map[string][]signingKey, issuer string, kid string) []byte {
lock.RLock()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lonelycode I am merging pieces of this PR to the master branch...Do you recall what was wrong with having the lock.RLock() inside of the findKey func? I see you changed the approach but I dont see the issue with your previous one.

@lonelycode
Copy link
Author

Hmmm, for the life of me I cannot remember :-/

altaurog and others added 14 commits August 16, 2018 18:07
This makes diagnosing the problem (on tyk) much easier, since the error returned
here ends up in the logs.
This brings in the change from one of the use cases we have for this library. It's been a part of the vendored version only, which obviously breaks easily and can't be tracked normally, so should be a part of the repo.
Also updates usage of go-jose as it changed Json* type names to all uppercase some time ago, which breaks things unless the application pins a specific version (which needs to be deduced).
Exposes TokenValidator func and JWTTokenValidator interface, updates
Make token getter function customizable
Configuration object had api change
add support for dsa and ecdsa keys
Change bumps version golang-jwt librarie and fixes changes
in jwt.Parse function definition, which is golang-jwt library
braking change.
Change bumps version of golang-jwt/v4 to v4.4.2.
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

Successfully merging this pull request may close these issues.

9 participants