authn

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationRoute

type AuthenticationRoute interface {
	// IsPath returns true if the path is within the route that is
	// authenticated.
	IsPath(path string) bool
	// HandleError handles the error to be returned to the client in the
	// event of authentication failure.
	HandleError(err error, w http.ResponseWriter, r *http.Request)
}

AuthenticationRoute is particular route that is authenticated, e.g. api, ui, etc.

type Authenticator

type Authenticator interface {
	Authenticate(w http.ResponseWriter, r *http.Request) (authz.Subject, error)
}

Authenticator authenticates a request; if successful it returns the authenticated subject; if invalid an error is returned; if there is no appropriate means of authentication found in the request then a nil subject is returned.

type Middleware

type Middleware struct {
	Authenticators []Authenticator
	Route          AuthenticationRoute
	Logger         logr.Logger
}

Middleware is HTTP middleware that authenticates requests.

func (*Middleware) Authenticate

func (a *Middleware) Authenticate(next http.Handler) http.Handler

Authenticate authenticates inbound http requests. Where authentication succeeds, the authenticated subject is attached to the request context and the upstream handler is called.

Jump to

Keyboard shortcuts

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