jwt_token

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 10 Imported by: 0

README

JWT Token

JWT Token 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.token.modulename=github.com/chong19951021/token"
  - "--experimental.plugins.token.version=v1.0.0"

Activate plugin in your config

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
meta:
spec:
  plugin:
    jwt-token:
      secret: SECRET
      proxyHeaderName: injectedPayload
      authHeader: Authorization
      headerPrefix: Bearer

Use as docker-compose label

  labels:
        - "traefik.http.routers.my-service.middlewares=my-jwt-token@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"`
	ExpireMode      string `json:"expireMode,omitempty"`
	IgnoreOptions   bool   `json:"ignoreOptions,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