arjunradiant opened a new issue, #11780:
URL: https://github.com/apache/apisix/issues/11780

   ### Description
   
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: feeservice-route-test
     namespace: feeservice-test
     annotations:
       cert-manager.io/cluster-issuer: "letsencrypt-prod"
       nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
       nginx.ingress.kubernetes.io/ssl-redirect: "true"
   spec:
     http:
     - name: feeservice
       match:
         hosts:
         - services-test.airportauthority.net
         paths:
         - /feeservice/*
       backends:
       - serviceName: feeservice-test
         servicePort: 8080
       plugins:
       - name: proxy-rewrite
         enable: true
         config:
           regex_uri:
           - ^/feeservice/(.*)
           - "/$1"
       - name: cors
         enable: true
         config:
           allow_origins: "*"
           allow_methods: "GET, POST, PUT, DELETE, PATCH, OPTIONS, MKCOL, COPY, 
MOVE, PROPFIND, LOCK, UNLOCK, PATCH, TRACE"
           allow_headers: "*"
           expose_headers: "*"
       - name: openid-connect
         enable: true
         config:
           bearer_only: true
           client_id: apisix
           client_secret: 5w0ne2td7AOf49FMT7pZr9BgQhverkPY
           discovery: 
https://keycloak.airportauthority.net/realms/Airport-Authority/.well-known/openid-configuration
       - name: serverless-pre-function
         enable: true
         config:
           functions:
             - |
               return function(conf, ctx)
                 local core = require("apisix.core")
                 local jwt = require("resty.jwt")
                 local jwt_token = core.request.header(ctx, "Authorization")
                 if jwt_token then
                     local _, _, jwt_token_only = string.find(jwt_token, 
"Bearer%s+(.+)")
                     if jwt_token_only then
                       local jwt_obj = jwt:load_jwt(jwt_token_only)
                       if jwt_obj.valid and jwt_obj.payload.groups then
                         local groups_claim_value = 
table.concat(jwt_obj.payload.groups, ",")
                         core.request.set_header(ctx, "groups", 
groups_claim_value)
                       end
                     end
                 end
               end
   
     - name: swagger-ui
       match:
         hosts:
         - services-test.airportauthority.net
         paths:
         - /feeservice/swagger-ui/*
       backends:
       - serviceName: feeservice-test
         servicePort: 8080
       plugins:
       - name: proxy-rewrite
         enable: true
         config:
           regex_uri:
           - ^/swagger-ui/(.*)
           - "/$1"
       - name: cors
         enable: true
         config:
           allow_origins: "*"
           allow_methods: "GET, POST, PUT, DELETE, PATCH, OPTIONS, MKCOL, COPY, 
MOVE, PROPFIND, LOCK, UNLOCK, PATCH, TRACE"
           allow_headers: "*"
           expose_headers: "*"
   
     - name: swagger-config
       match:
         hosts:
         - services-test.airportauthority.net
         paths:
         - /feeservice/v3/*
       backends:
       - serviceName: feeservice-test
         servicePort: 8080
       plugins:
       - name: proxy-rewrite
         enable: true
         config:
           regex_uri:
           - ^(feeservice/v3/.*)
           - "/$1"
       - name: cors
         enable: true
         config:
           allow_origins: "*"
           allow_methods: "GET, POST, PUT, DELETE, PATCH, OPTIONS, MKCOL, COPY, 
MOVE, PROPFIND, LOCK, UNLOCK, PATCH, TRACE"
           allow_headers: "*"
           expose_headers: "*"
   
     - name: feeservice-wildcard
       match:
         hosts:
         - services-test.airportauthority.net
         paths:
         - "/*-fee/*"
       backends:
       - serviceName: feeservice-test
         servicePort: 8080
       plugins:
       - name: proxy-rewrite
         enable: true
         config:
           regex_uri:
           - ^/(.*)
           - "/$1"
       - name: cors
         enable: true
         config:
           allow_origins: "*"
           allow_methods: "GET, POST, PUT, DELETE, PATCH, OPTIONS, MKCOL, COPY, 
MOVE, PROPFIND, LOCK, UNLOCK, PATCH, TRACE"
           allow_headers: "*"
           expose_headers: "*"
       - name: openid-connect
         enable: true
         config:
           bearer_only: true
           client_id: apisix
           client_secret: 5w0ne2td7AOf49FMT7pZr9BgQhverkPY
           discovery: 
https://keycloak.airportauthority.net/realms/Airport-Authority/.well-known/openid-configuration
       - name: serverless-pre-function
         enable: true
         config:
           functions:
             - |
               return function(conf, ctx)
                 local core = require("apisix.core")
                 local jwt = require("resty.jwt")
                 local jwt_token = core.request.header(ctx, "Authorization")
                 if jwt_token then
                     local _, _, jwt_token_only = string.find(jwt_token, 
"Bearer%s+(.+)")
                     if jwt_token_only then
                       local jwt_obj = jwt:load_jwt(jwt_token_only)
                       if jwt_obj.valid and jwt_obj.payload.groups then
                         local groups_claim_value = 
table.concat(jwt_obj.payload.groups, ",")
                         core.request.set_header(ctx, "groups", 
groups_claim_value)
                       end
                     end
                 end
               end
   
   ### 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`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to