Documentation ¶
Index ¶
- func AuthJwt() gin.HandlerFunc
- func AuthName() gin.HandlerFunc
- func AuthRule() gin.HandlerFunc
- func DeleteJwt(c *gin.Context, tokenKey interface{})
- func GenerateJwt(username string, password string) (string, error)
- func GetJwt(c *gin.Context, tokenKey interface{}) (tokenValue interface{})
- func SetJwt(c *gin.Context, tokenKey interface{}, tokenValue interface{})
- func StatCost() gin.HandlerFunc
- type JwtClaims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthJwt ¶
func AuthJwt() gin.HandlerFunc
AuthJwt 验证授权中间件 https://gin-gonic.com/docs/examples/custom-middleware/ https://gin-gonic.com/docs/examples/cookie/ https://github.com/dgrijalva/jwt-go 登录成功 设置Jwt jwtToken, _ := middleware.GenerateJwt(account.Username, common.DecodeBase64(account.Password)) middleware.SetJwt(c, "jwtToken", jwtToken) 注销成功 删除Jwt middleware.DeleteJwt(c, "jwtToken")
func AuthName ¶
func AuthName() gin.HandlerFunc
AuthName 验证姓名中间件 https://gin-gonic.com/docs/examples/custom-middleware/
func AuthRule ¶
func AuthRule() gin.HandlerFunc
AuthRule 验证规则中间件 https://gin-gonic.com/docs/examples/custom-middleware/
func GenerateJwt ¶
GenerateJwt 生成Jwt https://godoc.org/github.com/dgrijalva/jwt-go#NewWithClaims
func StatCost ¶
func StatCost() gin.HandlerFunc
StatCost 请求耗时中间件 https://gin-gonic.com/docs/examples/custom-middleware/
Types ¶
Click to show internal directories.
Click to hide internal directories.