Git Product home page Git Product logo

proxy-wasm-jwt-filter's Introduction

Proxy JWT Filter in WebAssembly

JWT filter plugin written in Go using Go SDK for Proxy-WASM. Compiled using Tinygo. Suitable for environments such as Envoy, Istio, etc.

Features

  • Provides JWT validation
  • Supports configuration using JSON
  • Supports path matching
  • Custom validation rules
  • Integrated statistics functionality
  • Highly scalable

Build

This plugin compiles Go language source code to WASM using Tinygo. Follow the official documentation to install Tinygo.

In the root directory of this project, execute the script to build:

$ bash ./script/build.sh

The target file is jwt-filter.wasmใ€‚

Run Example

This project provides an example envoy.yaml configuration file and Dockerfile in the ./examples directory, which can be used to build a simple Envoy image using this plugin. Docker should be installed in the environment beforehand.

Execute the following script to build the Docker image:

$ bash ./script/docker_build.sh

This will build an image named wokron/envoy:demo. Use the following command to run the image:

$ docker run \
    -it \
    --rm \
    -p 18000:18000 \
    -p 8001:8001 \
    wokron/envoy:demo

This will run an Envoy container with the JWT Filter. Requests under the path /api/v1 will undergo JWT validation, except for /api/v1/abc; other paths will be denied. According to the configuration, the JWT key used is your-secure-key.

$ curl localhost:18000/api/v1/abc
hello from the server
$ curl localhost:18000/api/v1/xxx
Forbidden
$ curl localhost:18000/api/v2/abc
Forbidden

Additionally, this plugin provides statistics functionality, which can be obtained through the Prometheus interface of Envoy.

$ curl localhost:8001/stats/prometheus | grep "envoy_wasm_jwt_filter"

Configuration

This plugin supports configuration using JSON. For specific configurations, refer to the configuration documentation.

proxy-wasm-jwt-filter's People

Contributors

wokron avatar

Stargazers

 avatar

Watchers

 avatar

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.