蛋蛋星球-客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
494 B

  1. package auth
  2. import (
  3. "time"
  4. "github.com/dgrijalva/jwt-go"
  5. )
  6. // TokenExpireDuration is jwt 过期时间
  7. const (
  8. TokenKey = "egg_app_jwt_token:%d" // jwt, 占位符:ip, admin:id
  9. TokenCacheTime = 3600 * 24 * 30 * 6 //半年
  10. TokenExpireDuration = time.Hour * 24 * 30 * 6 //半年
  11. )
  12. var Secret = []byte("egg_app")
  13. // JWTUser 如果想要保存更多信息,都可以添加到这个结构体中
  14. type JWTUser struct {
  15. Uid int64 `json:"uid"`
  16. jwt.StandardClaims
  17. }