Is it possible the kong return result of decode JWT token and pass it into our service?
maybe there is a additional key in the header x-user-id
when we receiving request in our service.
note: I am using Kong DB less and kubernetes
Is it possible the kong return result of decode JWT token and pass it into our service?
maybe there is a additional key in the header x-user-id
when we receiving request in our service.
note: I am using Kong DB less and kubernetes
Yes, you can do that with the Kong and plugin easily.
Here is the plugin you can use which will add additional details to the Header and which will get passed to the backend service. Plugin name : kong-plugin-jwt-keycloak
Github : https://github.com/BGaunitz/kong-plugin-jwt-keycloak
i have used the same, although for UI i was using Konga dashboard with Kong.
My Article link : https://faun.pub/kong-jwt-scope-base-auth-with-keycloak-b9938a96d281
You might have to custom build the Docker image for Kong adding plugin from Github.
FROM kong:2.0.3-alpine
LABEL description=”Alpine + Kong 2.0.3 + kong-oidc plugin”ENV OIDC_PLUGIN_VERSION=1.1.0–0
ENV JWT_PLUGIN_VERSION=1.1.0–1
USER root
RUN apk update && apk add git unzip luarocks
RUN luarocks install kong-oidc
RUN git clone — branch 20200505-access-token-processing https://github.com/BGaunitz/kong-plugin-jwt-keycloak.git \
&& cd kong-plugin-jwt-keycloak \
&& luarocks make
RUN luarocks pack kong-plugin-jwt-keycloak ${JWT_PLUGIN_VERSION} \
&& luarocks install kong-plugin-jwt-keycloak-${JWT_PLUGIN_VERSION}.all.rock
USER kong
https://medium.com/faun/building-kong-custom-docker-image-add-a-customized-kong-plugin-2157a381d7fd