github_webhook_middleware

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 9 Imported by: 0

README

GitHub Webhook Middleware

GitHub Webhook Middleware is a middleware plugin for Traefik which validates the signature in the X-Hub-Signature-256 header.

Configuration

Install with command

command:
  - "--experimental.plugins.gh-webhook.modulename=github.com/georg-jung/github-webhook-middleware"
  - "--experimental.plugins.gh-webhook.version=v0.1.2"

Or install inside static config file:

experimental:
  plugins:
    gh-webhook:
      modulename: github.com/georg-jung/github-webhook-middleware
      version: v0.1.2

Activate plugin in your dynamic config file

http:
  middlewares:
    my-gh-webhook-middleware:
      plugin:
        gh-webhook:
          secret: SECRET
          authHeader: X-Hub-Signature-256
          headerPrefix: sha256=

Use as docker-compose label

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

Inspired by 23deg/jwt-middleware

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" loggable:"false"`
	AuthHeader   string `json:"authHeader,omitempty"`
	HeaderPrefix string `json:"headerPrefix,omitempty"`
}

func CreateConfig

func CreateConfig() *Config

type GHW

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

func (*GHW) ServeHTTP

func (g *GHW) ServeHTTP(res http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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