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

help request: authz-keycloak with authorization_code #11960

Open
SKDragon18 opened this issue Feb 10, 2025 · 2 comments
Open

help request: authz-keycloak with authorization_code #11960

SKDragon18 opened this issue Feb 10, 2025 · 2 comments
Labels
question label for questions asked by users

Comments

@SKDragon18
Copy link

SKDragon18 commented Feb 10, 2025

Description

Hi i use authz-keycloak for getting token from keycloak use grant_type default "urn:ietf:params:oauth:grant-type:uma-ticket", it support password. I want to know what else option grant_type or api create route for getting token by authorization_code

Environment

  • APISIX version (run apisix version):
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):
@dosubot dosubot bot added the question label for questions asked by users label Feb 10, 2025
@SKDragon18 SKDragon18 changed the title help request: help request: authz-keycloak with authorization_code Feb 10, 2025
@SKDragon18
Copy link
Author

SKDragon18 commented Feb 10, 2025

This is my curl to create route in apisix:

curl -X PUT "http://127.0.0.1:9180/apisix/admin/routes/keycloak-authen" \
     -H "X-API-KEY: xxx" \ 
     -H "Content-Type: application/json" \
     -d '{
       "uri": "/auth/token",
       "plugins": {
         "authz-keycloak": {
           "token_endpoint": "http://host.docker.internal:8080/realms/apisix_test_realm/protocol/openid-connect/token",
           "client_id": "xxx", 
           "client_secret": "xxx", 
           "password_grant_token_generation_incoming_uri": "/auth/token"
         }
       },
       "upstream": {
         "type": "roundrobin",
         "nodes": {
           "host.docker.internal:8080": 1
         }
       }
     }'

@SKDragon18
Copy link
Author

i found solution, i use route with proxy-rewrite instead of authz-keycloak. The goal is for Access_Token to keep Issuer - the domain of Keycloak instead of returning Apisix's domain when encrypted.
Curl like that:

curl -X PUT "http://127.0.0.1:9180/apisix/admin/routes/keycloak-authen" \
     -H "X-API-KEY: xxx" \
     -H "Content-Type: application/json" \
     -d '{
        "id": "keycloak-authen",
        "uri": "/auth/token",
        "methods": ["POST"],
        "plugins": {
          "proxy-rewrite": {
            "regex_uri": ["/auth/token", "/realms/apisix_test_realm/protocol/openid-connect/token"]
          }
        },
        "upstream": {
          "type": "roundrobin",
          "nodes": {
            "host.docker.internal:8080": 1
          },
          "scheme": "http",
          "pass_host": "rewrite",
          "upstream_host": "host.docker.internal:8080"
        }
      }'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question label for questions asked by users
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant