pingora icon indicating copy to clipboard operation
pingora copied to clipboard

Dynamic routing based on JWT Claim

Open gitmffonseca opened this issue 11 months ago • 2 comments

What is the problem your feature solves, or the need it fulfills?

Dynamic routing based on JWT Claim.

Is a technique where the routing decision for incoming requests is made dynamically by examining the claims present in the JWT provided in the request.

This method allows for highly flexible and secure API management, as routing decisions can be customized based on the user's identity, roles, or any other attributes included in the token.

Describe the solution you'd like

I would like to enable it by a plugin or a configuration method

Describe alternatives you've considered

None, I've only came across with "Pingora" recently and I know some other solutions that have this feature.

gitmffonseca avatar Jan 27 '25 13:01 gitmffonseca

You should certainly be able to do this though the functionality is not likely to live within the core pingora code itself (more likely a module or your own code).

drcaramelsyrup avatar Jan 31 '25 17:01 drcaramelsyrup

You can do this in the request_filter where you have access to the request, it doesn't look like a difficult task. In addition, you can make it much more flexible and with your own rules.

as an example of an idea, we have a similar yml config in our project, in which we describe the rules and apply them.

services:
  - path: "/endpoint"
    target_host: "localhost:8080"
    policies: ["test_policy"] 
    tls: true 
    sni: "localhost"
    endpoints:  
      private: 
        - path: "^/metrics"
      public: 
        - path: "^/"
          # policies: ["test_policy2"] 
        - path: "^/get"

ibatanov avatar Feb 06 '25 09:02 ibatanov