jwt_middleware

package module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2021 License: MIT Imports: 7 Imported by: 0

README

JWT Middleware

JWT Middleware is a middleware plugin for Traefik which verifies a jwt token and adds the payload as injected header to the request

Configuration

Start with command

command:
  - "--experimental.plugins.jwt-middleware.modulename=github.com/23deg/jwt-middleware"
  - "--experimental.plugins.jwt-middleware.version=v0.1.2"

Activate plugin in your config

http:
  middlewares:
    my-jwt-middleware:
      plugin:
        jwt-middleware:
          secret: SECRET
          proxyHeaderName: injectedPayload
          authHeader: Authorization
          headerPrefix: Bearer

Use as docker-compose label

  labels:
        - "traefik.http.routers.my-service.middlewares=my-jwt-middleware@file"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error)

Types

type Config

type Config struct {
	Secret          string `json:"secret,omitempty"`
	ProxyHeaderName string `json:"proxyHeaderName,omitempty"`
	AuthHeader      string `json:"authHeader,omitempty"`
	HeaderPrefix    string `json:"headerPrefix,omitempty"`
}

func CreateConfig

func CreateConfig() *Config

type JWT

type JWT struct {
	// contains filtered or unexported fields
}

func (*JWT) ServeHTTP

func (j *JWT) ServeHTTP(res http.ResponseWriter, req *http.Request)

type Token

type Token struct {
	// contains filtered or unexported fields
}

Token Deconstructed header token

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL