Documentation
¶
Index ¶
- Constants
- Variables
- func AesAuth[T any](conf *AesAuthConf[T]) gin.HandlerFunc
- func Cross() gin.HandlerFunc
- func GiveGatePass[T any](identity T, conf *AesAuthConf[T]) gin.HandlerFunc
- func Logger(logger alog.Logger) gin.HandlerFunc
- func Recover(logger alog.Logger) gin.HandlerFunc
- type AesAuthConf
- type AesAuthConfOption
- type ErrCallback
- type PassCallback
Constants ¶
View Source
const ( AccessToken = "AccessToken" PanicPassCallbackIsNil = "PassCallback is nil" PanicErrCallbackIsNil = "ErrCallback is nil" )
Variables ¶
View Source
var ErrIdentityType = errors.New("'identity' must be a struct or a pointer to a struct")
ErrIdentityType is the error for identity type
View Source
var ErrTokenEmpty = errors.New("token is empty")
ErrTokenEmpty is the error for token empty
View Source
var ErrTokenInvalid = errors.New("token is invalid")
ErrTokenInvalid is the error for token invalid
Functions ¶
func AesAuth ¶
func AesAuth[T any](conf *AesAuthConf[T]) gin.HandlerFunc
AesAuth is a middleware for aes auth It will check the token in header
func GiveGatePass ¶
func GiveGatePass[T any](identity T, conf *AesAuthConf[T]) gin.HandlerFunc
GiveGatePass is the pass callback for give gate
Types ¶
type AesAuthConf ¶
type AesAuthConf[T any] struct { HeaderKey string PassCallback PassCallback[T] ErrCallback ErrCallback AesCipher *cipher.AesCipher }
AesAuthConf is the config for AesAuth
func NewAesAuthConf ¶
func NewAesAuthConf[T any](options ...AesAuthConfOption[T]) *AesAuthConf[T]
NewAesAuthConf returns a new AesAuthConf
type AesAuthConfOption ¶ added in v1.1.0
type AesAuthConfOption[T any] func(conf *AesAuthConf[T])
func WithAesCipher ¶ added in v1.1.0
WithAesCipher sets the aes cipher
func WithErrCallback ¶ added in v1.1.0
func WithErrCallback[T any](errCallback ErrCallback) AesAuthConfOption[T]
WithErrCallback sets the error callback
func WithHeaderKey ¶ added in v1.1.0
WithHeaderKey sets the header key
func WithPassCallback ¶ added in v1.1.0
func WithPassCallback[T any](passCallback PassCallback[T]) AesAuthConfOption[T]
WithPassCallback sets the pass callback
Click to show internal directories.
Click to hide internal directories.