middlewares

package
v0.0.0-...-50ca23e Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ApiCheckAesApiDataKey = "_api_check_aes_api_data"
View Source
const ApiCheckAesEncryptorKey = "_api_check_aes_encryptor"

Variables

This section is empty.

Functions

func ApiCheckAesDecryptData

func ApiCheckAesDecryptData(gc *gin.Context, v interface{}) (err error)

func ApiCheckAesEncryptData

func ApiCheckAesEncryptData(gc *gin.Context, data interface{}) (enData string, err error)

func ApiCheckAesGetEnData

func ApiCheckAesGetEnData(gc *gin.Context) string

func ApiCheckAesGetEncryptor

func ApiCheckAesGetEncryptor(gc *gin.Context) (encryptor *utilEnc.AesEncryptor, err error)

func ApiCheckAesHandler

func ApiCheckAesHandler(getSecret GetSecretFunc, debug ...bool) gin.HandlerFunc

func CorsHandler

func CorsHandler(config *CorsConfig) gin.HandlerFunc

func SessionHandler

func SessionHandler(before func(s sessions.Session, c *gin.Context), after func(s sessions.Session, c *gin.Context)) gin.HandlerFunc

Types

type CorsConfig

type CorsConfig struct {
	AllowAllOrigins  bool     `json:"allow_all_origins"`
	AllowOrigins     []string `json:"allow_origins,omitempty"`
	AllowHeaders     []string `json:"allow_headers,omitempty"`
	AllowMethods     []string `json:"allow_methods,omitempty"`
	AllowCredentials bool     `json:"allow_credentials,omitempty"`
	MaxAgeHours      int      `json:"max_age_hours,omitempty"`
	AllowWebSockets  bool     `json:"allow_web_sockets,omitempty"`
}

type GetSecretFunc

type GetSecretFunc func(appId string, gc *gin.Context) (secret string, err error)

Jump to

Keyboard shortcuts

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