serverless pre function not working / need to extract groups from payload data generated from jwt token #11777
Replies: 2 comments
-
I found a similar open issue regarding the To troubleshoot your issue, ensure the following:
If these steps do not resolve the issue, consider reviewing the open issue for any updates or additional troubleshooting steps. |
Beta Was this translation helpful? Give feedback.
-
@indrekj @huacnlee @markokocic @jaysonsantos please can you help me with the above |
Beta Was this translation helpful? Give feedback.
-
This is my yaml for the serverless pre function
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:
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: "*, groups" # Expose 'groups' header
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")
name: swagger-ui
match:
hosts:
paths:
backends:
servicePort: 8080
plugins:
enable: true
config:
regex_uri:
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: "*, groups" # Expose 'groups' header
name: swagger-config
match:
hosts:
paths:
backends:
servicePort: 8080
plugins:
enable: true
config:
regex_uri:
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: "*, groups" # Expose 'groups' header
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:
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: "*, groups" # Expose 'groups' header
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")
but when I use curl the serverless pre function doesnt seem to work , I get responce till the cors plugin only.
Beta Was this translation helpful? Give feedback.
All reactions