authenticate

package
v0.30.9 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

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

Authentication applies login flows to authenticate requests.

func (*Authentication) Flow

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

func (*Authentication) FlowRef

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

func (*Authentication) ServeHTTP

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

func (Bearer) Forbid

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

type FlowBuilder

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

FlowBuilder configures a login flow.

func WithFlow

func WithFlow(flow login.Flow) *FlowBuilder

WithFlow returns new authentication middleware for the supplied login flow.

func WithFlowRef

func WithFlowRef(flow string) *FlowBuilder

WithFlowRef returns new authentication middleware for the supplied login flow reference.

func (*FlowBuilder) Bearer

func (b *FlowBuilder) Bearer() *Authentication

func (*FlowBuilder) Scheme

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

type Scheme

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

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