Documentation
¶
Index ¶
Constants ¶
View Source
const ( UsernameKey = "username" KeyUserID = "userid" UserIP = "ip" )
Variables ¶
View Source
var ( TokenExpired = errors.New("Token is expired") TokenNotValidYet = errors.New("Token not active yet") TokenMalformed = errors.New("That's not even a token") TokenInvalid = errors.New("Couldn't handle this token:") )
View Source
var Middlewares = defaultMiddlewares()
Functions ¶
func Cors ¶
func Cors() gin.HandlerFunc
func JWTAuth ¶
func JWTAuth(signKey string) gin.HandlerFunc
func TracingHandler ¶
func TracingHandler(service string) gin.HandlerFunc
Types ¶
type AuthOperator ¶
type AuthOperator struct {
// contains filtered or unexported fields
}
func (*AuthOperator) AuthFunc ¶
func (ao *AuthOperator) AuthFunc() gin.HandlerFunc
func (*AuthOperator) SetStrategy ¶
func (ao *AuthOperator) SetStrategy(strategy AuthStrategy)
type AuthStrategy ¶
type AuthStrategy interface {
AuthFunc() gin.HandlerFunc
}
type CustomClaims ¶
type JWT ¶
type JWT struct {
SigningKey []byte
}
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)
解析 token
Click to show internal directories.
Click to hide internal directories.