client

package module
v0.0.0-...-3eeddce Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: EUPL-1.2 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHTTPProtocols

func GetHTTPProtocols() *http.Protocols

Returns *http.Protocols that are used by authentication engine http server and clients.

func NewSocketClient

func NewSocketClient(socketPath string) *http.Client

Creates an *http.Client to communicate with the authentication engine that serves over a unix domain socket.

Types

type AuthData

type AuthData struct {
	User string                     // User name
	Role []authv1.Role              // User roles
	Raw  *authv1.VerifyTokenRequest // Extracted Token
}

Authentication data to pass through [http.Handler]s as context value.

func AuthDataFrom

func AuthDataFrom(ctx context.Context) (ad AuthData, ok bool)

Extracts AuthData from the given context.

func (AuthData) WithContext

func (ad AuthData) WithContext(ctx context.Context) context.Context

Encapsulates AuthData in the context.

type AuthDataKey

type AuthDataKey int

Keys to store auth data in context.

type AuthMiddleware

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

Middleware to perform authentication over Auth Engine.

func NewAuthMiddleware

func NewAuthMiddleware(baseUrl string, client *http.Client, system *authv1.System) *AuthMiddleware

Creates a new AuthMiddleware.

func (*AuthMiddleware) Authenticate

func (c *AuthMiddleware) Authenticate(next http.Handler) http.Handler

Middleware to authenticate HTTP requests with Basic Auth against authentication engine.

If 'Authentication' header is missing, an empty 401 response is sent, if the token is invalid, a 403 status is returned, otherwise 'next' handler is called with AuthData in http.Request context (see AuthDataFrom).

Jump to

Keyboard shortcuts

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