jwt_rewrite

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MIT Imports: 11 Imported by: 0

README

JWT Rewrite

JWT Rewrite is a middleware plugin for Traefik which verifies a jwt token and rewrites a new jwt for further authentication

Inspired and modified from https://github.com/23deg/jwt-middleware

Configuration

Start with command

command:
  - "--experimental.plugins.jwt-rewrite.modulename=github.com/irotem/jwt-rewrite"
  - "--experimental.plugins.jwt-rewrite.version=v0.1"

Activate plugin in your config

http:
  middlewares:
    my-jwt-rewrite:
      plugin:
        jwt-rewrite:
          hash: HS256
          verify:
            secret: SECRET
            authHeader: Authorization
            headerPrefix: Bearer
          sign:
            secret: SECRET
            authHeader: Authorization
            headerPrefix: Bearer  

Use as docker-compose label

  labels:
        - "traefik.http.routers.my-service.middlewares=my-jwt-rewrite@prodvider"

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 {
	VerifySecret       string            `json:"VerifySecret,omitempty"`
	VerifyAuthHeader   string            `json:"VerifyAuthHeader,omitempty"`
	VerifyHeaderPrefix string            `json:"VerifyHeaderPrefix,omitempty"`
	VerifyHash         string            `json:"VerifyHash,omitempty"`
	SignSecret         string            `json:"SignSecret,omitempty"`
	SignAuthHeader     string            `json:"SignAuthHeader,omitempty"`
	SignHeaderPrefix   string            `json:"SignHeaderPrefix,omitempty"`
	SignHash           string            `json:"SignHash,omitempty"`
	CopyClaims         map[string]string `json:"copyclaims,omitempty"`
	StaticClaims       map[string]string `json:"copyclaims,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 JWTHeader

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

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