All Projects → Optum → kong-upstream-jwt

Optum / kong-upstream-jwt

Licence: other
A plugin for Kong which adds a signed JWT to HTTP Headers to backend requests

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to kong-upstream-jwt

kong-oidc-auth
OpenID Connect authentication with Kong gateway
Stars: ✭ 41 (+2.5%)
Mutual labels:  api-gateway, kong, optum
Kong Docs Cn
微服务 Api 网关 Kong 最新文档中文版
Stars: ✭ 371 (+827.5%)
Mutual labels:  api-gateway, kong
kong-scalable-rate-limiter
Kong plugin for Rate Limiting at high throughputs.
Stars: ✭ 19 (-52.5%)
Mutual labels:  api-gateway, kong
kong-plugin-api-response-merger
Kong API response merger plugin
Stars: ✭ 14 (-65%)
Mutual labels:  api-gateway, kong
kong
Kong docker image that easily installs plugins from source code.
Stars: ✭ 20 (-50%)
Mutual labels:  api-gateway, kong
Kong
🦍 The Cloud-Native API Gateway
Stars: ✭ 30,838 (+76995%)
Mutual labels:  api-gateway, kong
kong-plugin-url-rewrite
Kong API Gateway plugin for url-rewrite purposes
Stars: ✭ 43 (+7.5%)
Mutual labels:  api-gateway, kong
kong-ui
UI for KONG API Gateway
Stars: ✭ 20 (-50%)
Mutual labels:  api-gateway, kong
kong-java-client
Java Client for Kong API Gateway configuration
Stars: ✭ 69 (+72.5%)
Mutual labels:  api-gateway, kong
gluu-gateway
Gluu API 🚀 and Web Gateway 🎯
Stars: ✭ 29 (-27.5%)
Mutual labels:  api-gateway, kong
okta-api-center
Get up and running quickly with Okta's OAuth as a Service and your favorite API Gateway.
Stars: ✭ 58 (+45%)
Mutual labels:  api-gateway, kong
kong-map
Kongmap is a free visualization tool which allows you to view and edit configurations of your Kong API Gateway Clusters, including Routes, Services, and Plugins/Policies. The tool is being offered for installation via Docker and Kubernetes at this time.
Stars: ✭ 60 (+50%)
Mutual labels:  api-gateway, kong
django-api-bouncer
Simple Django app to provide API Gateways for micro-services
Stars: ✭ 18 (-55%)
Mutual labels:  api-gateway, kong
kong-circuit-breaker
Kong plugin for wrapping all proxy calls with a circuit-breaker
Stars: ✭ 27 (-32.5%)
Mutual labels:  kong
kong-config-manager
Yet another Kong CLI tool who can dump live configurations and apply your own backup configurations. In other words, configuration as code (CAC).
Stars: ✭ 15 (-62.5%)
Mutual labels:  kong
demo-serverless-aspnetcore
ASP.Net Core 3.1 on AWS Lambda demo
Stars: ✭ 22 (-45%)
Mutual labels:  api-gateway
api-front
api统一前端、转发代理、协议分析、流量复制
Stars: ✭ 97 (+142.5%)
Mutual labels:  api-gateway
reactivesearch-api
API Gateway for Elasticsearch with declarative querying and out-of-the-box access controls
Stars: ✭ 146 (+265%)
Mutual labels:  api-gateway
kong-plugin-http-anti-replay-attack
http-anti-replay-attack [防重放攻击]
Stars: ✭ 20 (-50%)
Mutual labels:  kong
skywalking-kong
Kong agent for Apache SkyWalking
Stars: ✭ 17 (-57.5%)
Mutual labels:  kong

Kong Upstream JWT Plugin

Overview

This plugin will add a signed JWT into the HTTP Header JWT or config.header of proxied requests through the Kong gateway. The purpose of this, is to provide means of Authentication, Authorization and Non-Repudiation to API providers (APIs for which Kong is a gateway).

In short, API Providers need a means of cryptographically validating that requests they receive were A. proxied by Kong, and B. not tampered with during transmission from Kong -> API Provider. This token accomplishes both as follows:

  1. Authentication & Authorization - Provided by means of JWT signature validation. The API Provider will validate the signature on the JWT token (which is generating using Kong's RSA x509 private key), using Kong's public key. This public key can be maintained in a keystore, or sent with the token - provided API providers validate the signature chain against their truststore.
  2. Non-Repudiation - SHA256 is used to hash the body of the HTTP Request Body, and the resulting digest is included in the payloadhash element of the JWT body. API Providers will take the SHA256 hash of the HTTP Request Body, and compare the digest to that found in the JWT. If they are identical, the request remained intact during transmission.

Supported Kong Releases

Kong >= 1.0.x

Installation

Recommended:

$ luarocks install kong-upstream-jwt

Other:

$ git clone https://github.com/Optum/kong-upstream-jwt.git /path/to/kong/plugins/kong-upstream-jwt
$ cd /path/to/kong/plugins/kong-upstream-jwt
$ luarocks make *.rockspec

JWT Token

The following is an example of the contents of the decoded JWT token:

Header:

{
  "x5c": ["...der-encoded cert data..."],
  "alg": "RS256",
  "typ": "JWT",
  "kid": "..conf.key_id.." // Only present if conf.key_id configuration variable set
}

Payload:

{
  "aud": "kong-service-name", // The Kong Service Name
  "iss": "issuer", // Only set if issuer configuration variable available
  "iat": 1550258274, // Only set if issuer configuration variable available
  "exp": 1550258334, // 1 minute exp time
  "jti": "d4f10edb-c4f0-47d3-b7e0-90a30a885a0b", // Unique to every request - UUID
  "consumername": "consumer-username", // Consumer Username
  "consumerid": "consumer-id", // Consumer ID
  "payloadhash": "...sha256 hash of request payload..."
}

Configuration

Private and Public Keys

The plugin requires that Kong's private key be accessible in order to sign the JWT. We also include the x509 cert in the x5c JWT Header for use by API providers to validate the JWT.

JWT Issuer

JWT Issuer allows for the iss field to be set within the JWT token.

More information about JWT claims can be found here

Optional Plugin schema configurations:

private_key_location = "/path/to/kong/ssl/privatekey.key"
public_key_location = "/path/to/kong/ssl/kongpublickey.cer"
issuer = "issuer"
key_id = "keyId"
header = "JWT" //If you want to set the header key to something other than JWT
include_credential_type = false //Controls "Bearer " + JWT or just JWT in header

The first contains the path to your .key file, the second specifies the path to your public key in DER format .cer file.

Backwards Compatibility

To maintain backwards compatibility, support for passing the key locations through environment variables is also available. We access these via Kong's overriding environment variables KONG_SSL_CERT_KEY for the private key as well as KONG_SSL_CERT_DER for the public key.

If not already set, these can be done so as follows:

$ export KONG_SSL_CERT_KEY="/path/to/kong/ssl/privatekey.key"
$ export KONG_SSL_CERT_DER="/path/to/kong/ssl/kongpublickey.cer"

One last step is to make the environment variables accessible by an nginx worker. To do this, simply add these line to your nginx.conf

env KONG_SSL_CERT_KEY;
env KONG_SSL_CERT_DER;

Maintainers

jeremyjpj0916
rsbrisci

Feel free to open issues, or refer to our Contribution Guidelines if you have any questions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].