middlewares

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(
	authHandler func(ctx huma.Context, username, password string) (nextCtx huma.Context, allow bool),
	basicRealm string,
) func(ctx huma.Context, next func(huma.Context))

BasicAuth is a middleware that checks for basic auth credentials in the Authorization header. If the credentials are not present or are incorrect, it will return a 401 Unauthorized response. If the credentials are correct, it will call the next middleware in the chain. The authHandler function should return the next context and a boolean indicating if the request should be allowed. The basicRealm is the realm to use in the WWW-Authenticate header.

func SetCtxTransformers

func SetCtxTransformers(transformers []huma.Transformer) func(huma.Context, func(huma.Context))

SetCtxTransformers sets transformers slice to the context key. These transformers will be applied to the response in the humaApiWrapper.Transform method. It's for internal library usage, and it will work only if you use `hureg` lib registration functions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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