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.
Click to show internal directories.
Click to hide internal directories.