middleware

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(deps AuthDeps) app.HandlerFunc

func AuthenticateRequest added in v1.2.14

func AuthenticateRequest(ctx context.Context, deps AuthDeps, token string, path string) (context.Context, error)

func CorsMiddleware

func CorsMiddleware(c context.Context, ctx *app.RequestContext)

func DecryptDeviceRequest added in v1.3.13

func DecryptDeviceRequest(ctx context.Context, c *app.RequestContext, secret string, replayStore deviceauth.ReplayStore) error

DecryptDeviceRequest accepts only authenticated envelopes. All validation completes before plaintext is installed; unsigned query parameters cannot be mixed into an authenticated body or accepted on a bodyless POST.

func DeviceMiddleware added in v1.1.8

func DeviceMiddleware(configProvider func() config.DeviceConfig, replayStore deviceauth.ReplayStore) app.HandlerFunc

func EncryptDeviceResponse added in v1.3.13

func EncryptDeviceResponse(c *app.RequestContext, secret string) error

EncryptDeviceResponse preserves the data/time format and adds a signature.

func LoggerMiddleware

func LoggerMiddleware(enrichers ...requestmeta.Enricher) app.HandlerFunc

func NotifyMiddleware

func NotifyMiddleware(store repository.Store) app.HandlerFunc

func OptionalAuthMiddleware added in v1.14.15

func OptionalAuthMiddleware(deps AuthDeps) app.HandlerFunc

OptionalAuthMiddleware authenticates a request when it supplies an Authorization header, while preserving anonymous access for routes that intentionally support guest checkout. Handlers on those routes must still explicitly require an authenticated user before operating on a user-owned resource.

func PaymentNotifyContext added in v1.2.14

func PaymentNotifyContext(ctx context.Context, store repository.Store, platform, token string) (context.Context, error)

func TraceMiddleware

func TraceMiddleware() app.HandlerFunc

Types

type AuthDeps added in v1.19.0

type AuthDeps struct {
	JWT   config.JwtAuth
	Redis *redis.Client
	Store repository.Store
}

type PaymentParams

type PaymentParams struct {
	Platform string `uri:"platform"`
	Token    string `uri:"token"`
}

Jump to

Keyboard shortcuts

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