tokencheck

package module
v0.0.0-...-fdc0f77 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 7 Imported by: 0

README

Caddy Token Check

A Caddy module for restricting access to resources using Redis for API key storage.

Usage

Load this module with your Caddy build, point it at your Redis server, and protect your endpoints with an API key check for every request.

Build with Caddy
xcaddy build --with github.com/honeybadger-io/caddy-token-checker
Docker
docker run --net host -v ./Caddyfile:/etc/caddy/Caddyfile -p 2020:2020 honeybadger-io/caddy-token-checker

Credits

Thanks to caddy-geofence for a clear example of how to build middleware for Caddy.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenCheck

type TokenCheck struct {
	RedisUrl       string
	RedisClient    *redis.Client
	KeyPrefix      string
	QueryParameter string
}

func (TokenCheck) CaddyModule

func (TokenCheck) CaddyModule() caddy.ModuleInfo

func (*TokenCheck) Provision

func (tc *TokenCheck) Provision(ctx caddy.Context) error

func (TokenCheck) ServeHTTP

func (tc TokenCheck) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

func (*TokenCheck) UnmarshalCaddyfile

func (tc *TokenCheck) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

func (TokenCheck) Validate

func (tc TokenCheck) Validate() error

Jump to

Keyboard shortcuts

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