token

package module
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

README

caddy-token

Caddy token based authentication. Supports static, signed and and JWT tokens

Example config

{
    order token first
}

:3000 {
    token {
        jwt {
            issuer https://dex.issuer.lan
            group admin
        }
    }
  
    reverse_proxy https://some.service.internal {
        header_up Host {http.reverse_proxy.upstream.hostport}
    }
}


Development

Read Extending Caddy to get an overview of what interfaces you need to implement.

building

You first need to build a new caddy executable with this plugin. The easiest way is to do this with xcaddy.

Install xcaddy:

go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest

After xcaddy installation you can build caddy with this plugin by executing:

xcaddy build v2.8.4 --with github.com/loafoe/caddy-token

usage

TODO

license

License is Apache 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LastNChars added in v0.32.0

func LastNChars(n int, s string) string

LastNChars returns the last n characters of a string.

Types

type Middleware

type Middleware struct {
	TokenFile string

	Issuer            string
	InjectOrgHeader   bool
	AllowUpstreamAuth bool
	Verify            bool

	TenantOrgClaim string
	SigningKey     string
	Groups         []string
	Scopes         []string
	// contains filtered or unexported fields
}

func (*Middleware) CaddyModule

func (m *Middleware) CaddyModule() caddy.ModuleInfo

func (*Middleware) Provision

func (m *Middleware) Provision(ctx caddy.Context) error

func (*Middleware) ServeHTTP

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

func (*Middleware) UnmarshalCaddyfile

func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

func (*Middleware) Validate

func (m *Middleware) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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