You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'm migrating from 0.11.5 to 0.12.6 and I've got a little problem :)
In short - I have a service that authorize users. The service is running in multiple instances, for examples below let's assume there are two instances A and B. Each instance is signing JWT with it's own private key (private keys A and B respectively). When signing a JWT service also put a kid header with the ID of key. Public keys and their IDs are stored in some cache (let's say Redis).
So, I've got situation on instance B when I need to verify token signed by instance A.
Previously (on 0.11.5) we first parsed data from token (including kid) and then we verified token by the Public key fetched from cache by this kid.
Currently (on 0.12.6), during migration, I faced out a problem - I couldn't parse headers without verifying the token, cause there is alg header present. I'm getting exception saying:
Cannot verify JWS signature: unable to locate signature verification key for JWS with header: {kid=my-very-awesome-key-id, alg=RS512}
The problem is that I need to parse token and extract kid first, but it's not possible cause I already need a key. Kinda cyclic dependency.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi! I'm migrating from 0.11.5 to 0.12.6 and I've got a little problem :)
In short - I have a service that authorize users. The service is running in multiple instances, for examples below let's assume there are two instances A and B. Each instance is signing JWT with it's own private key (private keys A and B respectively). When signing a JWT service also put a
kid
header with the ID of key. Public keys and their IDs are stored in some cache (let's say Redis).So, I've got situation on instance B when I need to verify token signed by instance A.
Previously (on 0.11.5) we first parsed data from token (including
kid
) and then we verified token by the Public key fetched from cache by thiskid
.Currently (on 0.12.6), during migration, I faced out a problem - I couldn't parse headers without verifying the token, cause there is
alg
header present. I'm getting exception saying:The problem is that I need to parse token and extract
kid
first, but it's not possible cause I already need a key. Kinda cyclic dependency.Code for JWS building:
Parser code (not working, throwing an exception):
P.S. using
unsecured
forParserBuilder
also doesn't work, cause thealg
header isn't none or missed, it's present.Beta Was this translation helpful? Give feedback.
All reactions