Documentation ¶
Index ¶
Constants ¶
View Source
const ( // jwt key Jwt = "jwt" JwtMsg = "jwt-msg" JwtAuth = "jwt-auth" JwtUser = "jwt-user" JwtUsername = "jwt-username" // jwt 错误信息 JwtTokenError = "jwt is error" JwtTokenEffective = "jwt is effective" JwtTokenCantBeEmpty = "jwt cannot be empty" JwtTokenExpired = "jwt is expired" JwtTokenNotValidYet = "jwt is not valid yet" )
Variables ¶
View Source
var DefaultJwtConfig = &JwtConfig{
JwtExpiresTime: 60 * 60 * 24 * 7,
JwtSigningKey: "tinytok",
}
Functions ¶
func CreateToken ¶
func CreateToken(claims *UserClaims) (string, error)
func JwtAuthMiddleware ¶ added in v0.2.1
func JwtAuthMiddleware() gin.HandlerFunc
func RefreshToken ¶
Types ¶
type UserClaims ¶
func ParseToken ¶
func ParseToken(tokenString string) (*UserClaims, error)
Click to show internal directories.
Click to hide internal directories.