Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic routing based on JWT Claim #519

Open
gitmffonseca opened this issue Jan 27, 2025 · 2 comments
Open

Dynamic routing based on JWT Claim #519

gitmffonseca opened this issue Jan 27, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@gitmffonseca
Copy link

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.

@gdavidsson gdavidsson added the enhancement New feature or request label Jan 31, 2025
@drcaramelsyrup
Copy link
Contributor

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).

@ibatanov
Copy link

ibatanov commented Feb 6, 2025

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants