middleware

package
v0.1.984 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	contract.MiddlewareOperator
}

func NewClient

func NewClient(d Dependencies, opts ClientOptions) (Client, error)

type ClientOption

type ClientOption = contract.Opt[ClientOptions]

func WithAuthorizationTimeout

func WithAuthorizationTimeout(x time.Duration) ClientOption

func WithAuthorizationURL

func WithAuthorizationURL(x *url.URL) ClientOption

func WithAuthorizePath added in v0.1.118

func WithAuthorizePath(x string) ClientOption

func WithIdempotencyHeaderKey

func WithIdempotencyHeaderKey(x string) ClientOption

func WithIdempotencyKeyTTL

func WithIdempotencyKeyTTL(x time.Duration) ClientOption

func WithIdempotencyTimeout

func WithIdempotencyTimeout(x time.Duration) ClientOption

func WithLoaded added in v0.1.163

func WithLoaded(x Loaded) ClientOption

func WithUserIDHeaderKey

func WithUserIDHeaderKey(x string) ClientOption

type ClientOptions

type ClientOptions struct {
	Loaded
	IdempotencyTimeout   time.Duration
	IdempotencyKeyTTL    time.Duration
	AuthorizationTimeout time.Duration
}

func ApplyClientOptions

func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions

type DefaultTool added in v0.1.24

type DefaultTool struct {
	T *contract.Tool[Client]
}

func NewTool

func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool

func (*DefaultTool) AuthenticateAny added in v0.1.201

func (d *DefaultTool) AuthenticateAny(next contract.HandlerFunc) contract.HandlerFunc

AuthenticateAny attempts to authenticate the request using any available authentication method.

func (*DefaultTool) AuthenticateFirebaseIDToken added in v0.1.24

func (d *DefaultTool) AuthenticateFirebaseIDToken(next contract.HandlerFunc) contract.HandlerFunc

AuthenticateFirebaseIDToken validates a Firebase ID token.

func (*DefaultTool) AuthenticateFirebaseModIDToken added in v0.1.179

func (d *DefaultTool) AuthenticateFirebaseModIDToken(next contract.HandlerFunc) contract.HandlerFunc

AuthenticateFirebaseModIDToken validates a Firebase Mod ID token.

func (*DefaultTool) AuthenticateOIDCToken added in v0.1.24

func (d *DefaultTool) AuthenticateOIDCToken(next contract.HandlerFunc) contract.HandlerFunc

AuthenticateOIDCToken validates an OIDC token.

func (*DefaultTool) AuthenticateWithSecret added in v0.1.179

func (d *DefaultTool) AuthenticateWithSecret(next contract.HandlerFunc) contract.HandlerFunc

AuthenticateWithSecret validates a request based on a secret.

func (*DefaultTool) Chain added in v0.1.24

Chain combines multiple middleware into a single handler.

func (*DefaultTool) CheckHeaders added in v0.1.24

func (d *DefaultTool) CheckHeaders(next contract.HandlerFunc) contract.HandlerFunc

CheckHeaders ensures essential headers are present and sets default ones.

func (*DefaultTool) CleanURLPath added in v0.1.24

func (d *DefaultTool) CleanURLPath(next contract.HandlerFunc) contract.HandlerFunc

CleanURLPath ensures that URL paths are clean and well-formed.

func (*DefaultTool) EnforceHTTPS added in v0.1.24

func (d *DefaultTool) EnforceHTTPS(next contract.HandlerFunc) contract.HandlerFunc

EnforceHTTPS redirects HTTP requests to HTTPS unless running locally.

func (*DefaultTool) Gzip added in v0.1.24

Gzip compresses HTTP responses when supported by the client.

func (*DefaultTool) IdempotentPOST added in v0.1.24

func (d *DefaultTool) IdempotentPOST(next contract.HandlerFunc) contract.HandlerFunc

IdempotentPOST ensures a POST request is only processed once.

func (*DefaultTool) RequireOwner added in v0.1.24

func (d *DefaultTool) RequireOwner(next contract.HandlerFunc) contract.HandlerFunc

RequireOwner enforces the owner permission on the request.

func (*DefaultTool) RequireReader added in v0.1.24

func (d *DefaultTool) RequireReader(next contract.HandlerFunc) contract.HandlerFunc

RequireReader enforces the reader permission on the request.

func (*DefaultTool) RequireWriter added in v0.1.24

func (d *DefaultTool) RequireWriter(next contract.HandlerFunc) contract.HandlerFunc

RequireWriter enforces the writer permission on the request.

type Loaded added in v0.1.122

type Loaded struct {
	AuthorizationURL     *url.URL
	AuthorizePath        string
	UserIDHeaderKey      string
	IdempotencyHeaderKey string
}

type Tool added in v0.1.245

type Tool interface {
	Client
}

Jump to

Keyboard shortcuts

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