middleware

package
v1.20.3 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 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

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

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

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

func EncryptDeviceResponse

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 PaymentStore) app.HandlerFunc

func OptionalAuthMiddleware

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

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

func TraceMiddleware

func TraceMiddleware() app.HandlerFunc

Types

type AuthDeps

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"`
}

type PaymentStore

type PaymentStore interface {
	Payment() repository.PaymentRepo
}

Jump to

Keyboard shortcuts

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