middleware

package
v0.0.0-...-2a7283e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HeaderAPIKey           = "X-API-Key"
	HeaderRateLimitBurst   = "X-Rate-Limit-Burst"
	HeaderRateLimitDaily   = "X-Rate-Limit-Daily"
	HeaderRateLimitMonthly = "X-Rate-Limit-Monthly"

	// Error messages
	ErrMsgAPIKeyRequired = "API key is required"
	ErrMsgInternalServer = "Internal server error"
)

Variables

This section is empty.

Functions

func RedirectIfNotLoggedIn

func RedirectIfNotLoggedIn(authService *authz.Service) gin.HandlerFunc

RedirectIfNotLoggedIn is a simpler middleware that redirects to a specified URL if the user is not logged in, instead of returning a JSON error.

func RequireAdmin

func RequireAdmin(authService *authz.Service) gin.HandlerFunc

RequireAdmin is middleware that ensures only admin users can access certain routes

func UserSession

func UserSession(authService *authz.Service) gin.HandlerFunc

UserSession is middleware that handles user session validation and setup.

func ValidateRequest

func ValidateRequest(service, permission string, conn *grpc.ClientConn) gin.HandlerFunc

ValidateRequest returns a middleware that validates API requests against the dev service

Types

This section is empty.

Jump to

Keyboard shortcuts

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