auth

package
v0.30.45 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Feature

func Feature(config ...func(*Installer)) miruken.Feature

Feature configures http server support

func WriteWWWAuthenticateHeader

func WriteWWWAuthenticateHeader(
	w http.ResponseWriter,
	scheme string,
	realm string,
	params map[string]string,
	err error,
)

WriteWWWAuthenticateHeader writes the `WWW-Authenticate` http response header for the supplied scheme.

Types

type Authentication

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

Authentication applies login flows to auth requests.

func (*Authentication) Required added in v0.30.42

func (a *Authentication) Required() *Authentication

func (*Authentication) ServeHTTP

func (*Authentication) WithFlow added in v0.30.39

func (a *Authentication) WithFlow(flow login.Flow) *FlowBuilder

func (*Authentication) WithFlowRef added in v0.30.39

func (a *Authentication) WithFlowRef(ref string) *FlowBuilder

type Basic added in v0.30.34

type Basic struct {
	Realm string
}

Basic is a http authentication Scheme that uses a username and password to protect resources.

func (Basic) Accept added in v0.30.34

func (b Basic) Accept(
	r *http.Request,
) (miruken.Handler, error, bool)

func (Basic) Challenge added in v0.30.34

func (b Basic) Challenge(
	w http.ResponseWriter,
	r *http.Request,
	err error,
) int

type Bearer

type Bearer struct {
	Realm string
}

Bearer is a http authentication Scheme that uses an opaque string (token) to protect resources.

func (Bearer) Accept

func (b Bearer) Accept(
	r *http.Request,
) (miruken.Handler, error, bool)

func (Bearer) Challenge

func (b Bearer) Challenge(
	w http.ResponseWriter,
	r *http.Request,
	err error,
) int

type FlowBuilder

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

FlowBuilder configures a login flow.

func WithFlow

func WithFlow(flow login.Flow) *FlowBuilder

WithFlow starts a new authentication flow builder with the definition of a login flow.

func WithFlowRef

func WithFlowRef(flow string) *FlowBuilder

WithFlowRef starts a new authentication flow builder with a reference to a login flow.

func (*FlowBuilder) Basic added in v0.30.34

func (b *FlowBuilder) Basic() *Authentication

Basic configures an authentication flow to use `Basic` auth.

func (*FlowBuilder) BasicInRealm added in v0.30.34

func (b *FlowBuilder) BasicInRealm(realm string) *Authentication

BasicInRealm configures an authentication flow to use `Basic` auth in the supplied realm.

func (*FlowBuilder) Bearer

func (b *FlowBuilder) Bearer() *Authentication

Bearer configures an authentication flow to use `Bearer` tokens.

func (*FlowBuilder) BearerInRealm

func (b *FlowBuilder) BearerInRealm(realm string) *Authentication

BearerInRealm configures an authentication flow to use `Bearer` tokens in the supplied realm.

func (*FlowBuilder) Scheme

func (b *FlowBuilder) Scheme(scheme Scheme) *Authentication

type Installer

type Installer struct{}

Installer configures http server support

func (*Installer) DependsOn

func (i *Installer) DependsOn() []miruken.Feature

func (*Installer) Install

func (i *Installer) Install(setup *miruken.SetupBuilder) error

type Scheme

type Scheme interface {
	Accept(*http.Request) (miruken.Handler, error, bool)
	Challenge(http.ResponseWriter, *http.Request, error) int
}

Scheme binds a http request to a login flow.

Jump to

Keyboard shortcuts

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