forwardauth

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

caddy-forwardauth

A simple implementation of the Traefik forward auth spec in a Caddy v2 Module. There are no plans to backport this to Caddy v1. This was primarily developed to add support to Authelia for Caddy, however it should work for several other systems that are compatible with Traefik's forward auth or nginx ngx_http_auth_request_module.

The intention was to copy the configuration options that Traefik uses for implementation ease.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ForwardAuth

type ForwardAuth struct {
	Address               string   `json:"address"`
	TrustedProxies        []string `json:"trustedProxies"`
	TrustForwardedHeaders bool     `json:"trustForwardedHeaders"`
	SetXOriginalURL       bool     `json:"setXOriginalURL"`

	AuthResponseHeaders []string `json:"authResponseHeaders"`
	AuthRequestHeaders  []string `json:"authRequestHeaders"`

	UserHeaders UserHeaders `json:"userHeaders"`

	TLS *TLSSettings `json:"util"`
	// contains filtered or unexported fields
}

ForwardAuth is the main Caddy module representation.

func (ForwardAuth) Authenticate

func (m ForwardAuth) Authenticate(rw http.ResponseWriter, req *http.Request) (user caddyauth.User, authenticated bool, err error)

func (ForwardAuth) CaddyModule

func (ForwardAuth) CaddyModule() caddy.ModuleInfo

func (*ForwardAuth) Provision

func (m *ForwardAuth) Provision(ctx caddy.Context) (err error)

func (*ForwardAuth) Validate

func (m *ForwardAuth) Validate() (err error)

type TLSSettings

type TLSSettings struct {
	CA                 string `json:"ca"`
	CAOptional         bool   `json:"caOptional"`
	CAIncludeSystem    bool   `json:"caIncludeSystem"`
	Certificate        string `json:"cert"`
	Key                string `json:"key"`
	InsecureSkipVerify bool   `json:"insecureSkipVerify"`

	Configuration *tls.Config `json:"-"`
}

TLSSettings are settings specific to TLS.

type UserHeaders

type UserHeaders struct {
	ID     string `json:"id"`
	Emails string `json:"emails"`
	Name   string `json:"name"`
	Groups string `json:"groups"`
}

UserHeaders maps headers to metadata fields for caddy.

Jump to

Keyboard shortcuts

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