Documentation ¶
Index ¶
Constants ¶
View Source
const ( UsernameKey = "username" KeyUserID = "userid" UserIP = "ip" )
Variables ¶
Functions ¶
func RecoveryHandler ¶
func RecoveryHandler() gin.HandlerFunc
RecoveryHandler 将 在 错误 中恢复 并返回 500 http 状态码
func TracingHandler ¶
func TracingHandler(service string) gin.HandlerFunc
Types ¶
type JWT ¶
type JWT struct { SigningAlgorithm string // jwt签名算法 HsSigningKey []byte // jwt密钥 EsPrivKey *ecdsa.PrivateKey RsPrivKey *rsa.PrivateKey }
func (*JWT) CreateToken ¶
CreateToken 创建一个token
func (*JWT) ParseToken ¶
ParseToken 解析 token
type JwtOption ¶
type JwtOption func(j *JWT)
func WithEsAsymmetricEncrypt ¶
func WithEsAsymmetricEncrypt(alg string, privkey *ecdsa.PrivateKey) JwtOption
func WithHsSymmetricEncrypt ¶
func WithRsAsymmetricEncrypt ¶
func WithRsAsymmetricEncrypt(alg string, privkey *rsa.PrivateKey) JwtOption
Click to show internal directories.
Click to hide internal directories.