middleware

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUserTokenHeader      = "X-AuthAPI-UserToken"
	DefaultInternalAPIKeyHeader = "X-API-Key"
	DefaultClientAPIKeyHeader   = "X-USH-Client-Key"
)

Variables

This section is empty.

Functions

func CheckAuth

func CheckAuth(v *auth.Validator, header string) gin.HandlerFunc

CheckAuth rejects the request with 401 unless the header carries a valid user token with a user id and username. The user, subscription and raw token are stored in the request context, see auth.UserFromContext.

func ClientKeyAuth

func ClientKeyAuth(header, key string) gin.HandlerFunc

ClientKeyAuth rejects the request with 401 unless the header carries key. An empty key disables the check.

func EnrichUserData

func EnrichUserData(v *auth.Validator, header string) gin.HandlerFunc

EnrichUserData stores the user like CheckAuth when the header carries a valid user token, and otherwise lets the request through anonymously. It never rejects a request.

func InternalKey

func InternalKey(header, key string) gin.HandlerFunc

InternalKey rejects the request with 401 unless the header carries key. An empty key rejects every request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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