marcosbarbero / spring-cloud-zuul-ratelimit

Rate limit auto-configure for Spring Cloud Netflix Zuul

Home Page:https://blog.marcosbarbero.com/spring-cloud-netflix-zuul-rate-limit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use JWT token user id as policy key to limit traffic to each user

pradeepkusingh opened this issue · comments

Describe the question
How to use JWT token user id as policy key to limit traffic to each user

I have multiple user who are coming to my apigateway using JWT token and I would like to rate limit using JWT user id, how can I achieve that, any help would be highly appreciated.

Hello @pradeepkusingh, thanks for getting in touch, we will get back to you asap! If you have issues in the 1.x.x.RELEASE line we recommend you to update to the latest version, unfortunately this line is not supported anymore.

Hi @pradeepkusingh. Unfortunately, as of now, this is not a supported feature. There's a draft similar to this one at #347, but it wasn't finished.

Thanks @marcosbarbero , do we have any plan to wrap up the #347 ?

Unfortunately, I'm out of time to do that. If you feel like creating a PR I will be happy to review it

Hi @pradeepkusingh, you should be able to do this by creating a custom RateLimitKeyGenerator, where the key is the JWT user id. Of course you will need to parse and validate your JWTs inside the generator implementation - but this approach should work.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 1 day

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 1 day