Traefik middleware plugin which decodes a JWT token and forwards JWT claims as request headers. It can also rewrite values in tokens as needed.
This pllugin has been tested on Traefik v2.9.10, and works with that version, it may not be compatible with older versions (it's written with go1.20 in mind).
The plugin needs to be configured in the Traefik static configuration before it can be used.
The following snippet can be used as an example for the values.yaml
file:
experimental:plugins:enabled: trueadditionalArguments:- --experimental.plugins.traefik-jwt-headers.modulename=github.com/PingThingsIO/traefik-jwt-headers- --experimental.plugins.traefik-jwt-headers.version=v0.0.1
traefik \--experimental.plugins.traefik-jwt-headers.moduleName=github.com/PingThingsIO/traefik-jwt-headers \--experimental.plugins.traefik-jwt-headers.version=v0.0.1
apiVersion: traefik.containo.us/v1alpha1kind: Middlewaremetadata:name: jwt-headersspec:plugin:traefik-jwt-headers:claimsPrefix: attrheaders:displayName: X-WEBAUTH-NAMEemail: X-WEBAUTH-EMAILusername: X-WEBAUTH-USERNAMEunboxFirstElement: true
apiVersion: traefik.containo.us/v1alpha1kind: Middlewaremetadata:name: jwt-headersspec:plugin:traefik-jwt-headers:claimsPrefix: attrheaders:displayName: X-AUTH-NAMEemail: X-AUTH-EMAILusername: X-AUTH-USERNAMEunboxFirstElement: truevalueRewrite:username: #Claim to rewritealice: charlie # Old Value -> New Value
This software is released under the Apache 2.0 License