auth

package
v0.30.17 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 8 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) 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

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) 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(r *http.Request) (miruken.Handler, error, bool)
	Challenge(w http.ResponseWriter, r *http.Request, err 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