GithubHelp home page GithubHelp logo

kong-plugin-jwt-claims-headers's Introduction

kong-plugin-jwt-claims-headers

Add unencrypted, base64-decoded claims from a JWT payload as request headers to the upstream service.

How it works

When enabled, this plugin will add new headers to requests based on the claims in the JWT provided in the request. The generated headers follow the naming convention of X-<claim-name>. For example, if the JWT payload object is

{
  "sub"   : "1234567890",
  "name"  : "John Doe",
  "admin" : true
}

then the following headers would be added

X-Sub   : "1234567890"
X-Name  : "John Doe"
X-Admin : true

Configuration

Similar to the built-in JWT Kong plugin, you can associate the jwt-claims-headers plugin with an api with the following request

curl -X POST http://localhost:8001/apis/29414666-6b91-430a-9ff0-50d691b03a45/plugins \
  --data "name=jwt-claims-headers" \
  --data "config.uri_param_names=jwt" \
  --data "config.claims_to_include=.*" \
  --data "config.continue_on_error=true"
form parameter required description
name required The name of the plugin to use, in this case: jwt-claims-headers
uri_param_names optional A list of querystring parameters that Kong will inspect to retrieve JWTs. Defaults to jwt.
claims_to_include required A list of claims that Kong will expose in request headers. Lua pattern expressions are valid, e.g., kong-.* will include kong-id, kong-email, etc. Defaults to .* (include all claims).
continue_on_error required Whether to send the request to the upstream service if a failure occurs (no JWT token present, error decoding, etc). Defaults to true.

kong-plugin-jwt-claims-headers's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kong-plugin-jwt-claims-headers's Issues

How can I install it ?

Hi everyone. I encountered this problem when I installed it, show me how to solve it. please.

[4/4] RUN luarocks make:
#7 0.248
#7 0.249 kong-plugin-jwt-claims-headers 1.0-2 depends on lua ~> 5.1 (5.1-1 provided by VM)
#7 0.254
#7 0.254 Error: Build error: Failed installing handler.lua in /usr/local/lib/luarocks/rocks-5.1/kong-plugin-jwt-claims-headers/1.0-2/lua/kong/plugins/jwt-claims-headers/handler.lua: handler.lua: No such file or directory

My docker file
FROM kong:2.3.2

USER root

COPY ./plugins/kong-plugin-jwt-claims-headers /custom-plugins/kong-plugin-jwt-claims-headers

WORKDIR /custom-plugins/kong-plugin-jwt-claims-headers

RUN luarocks make

USER kong

ngx_re_gmatch nil error

I need to add this line in the handler.lua in order to run this plugin: local ngx_re_gmatch = ngx.re.gmatch

Do you create this function synonym somewhere else?

license

nice work! i'm considering using your plugin for a project i'm working on. was hoping you might add a license.

using in kong ingress controller

hello @wshirey

when i try to use this in kong ingress controller below exception is occured

jwt-claims-headers map[] false 0a36ec9f-b691-4df1-8aca-9a1a488c1a05 } in service c4aaa532-4254-4dd1-a20a-ba0b7755c19c: json: cannot unmarshal string into Go struct field Plugin.config of type v1.Configuration

the kongplugin resource config is below

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: key-jwt-header
labels:
plugin: "jwt-claims-headers"

is that anything additional to work with kong ingress?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.