Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JwtConsumer in multithreaded system

Tags:

jwt

jose4j

I just want to clarify is JwtConsumer thread safe? I'm going to use it with spring rest controller. Is it fine to use one consumer in whole application for multiple requests or better place it under request skope?

like image 902
Normal Avatar asked Mar 15 '26 20:03

Normal


1 Answers

Yes, JwtConsumer is thread safe as long as you are using a recent version and, if your using any additional validators or customizers, they are also thread safe.

There was previously an issue with thread safety but it was fixed in v0.4.3.

like image 119
Brian Campbell Avatar answered Mar 18 '26 09:03

Brian Campbell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!