Skip to content

sorasful/jwt-middleware-optional

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 This version of the fork allows one to specify that the authorization code is optional.

Meaning that if the authorization code is in the request, it will get checked, and if it does, the request will go through.

Meaning that if you want to check that a request is authenticated you'll need to verify that there is a Authorization header in your request.

Configuration

Start with command

command:
  - "--experimental.plugins.jwt-middleware.modulename=github.com/sorasful/jwt-middleware-optional"
  - "--experimental.plugins.jwt-middleware.version=v0.0.3"

Activate plugin in your config

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

Use as docker-compose label

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

About

Optional JWT verification for traefik v0.0.2

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%