Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingJwtToken = errors.Unauthorized(reason, "JWT token is missing") ErrTokenInvalid = errors.Unauthorized(reason, "Token is invalid") ErrTokenExpired = errors.Unauthorized(reason, "JWT token has expired") ErrTokenParseFail = errors.Unauthorized(reason, "Fail to parse JWT token ") ErrWrongContext = errors.Unauthorized(reason, "Wrong context for middleware") ErrorPermissionDenied = errors.Forbidden(reasonPermission, "Permission denied") )
Functions ¶
func GenerateToken ¶
GenerateToken 生成token
func NewContext ¶
NewContext put auth info into context
func Server ¶
func Server(jwtSecret string) middleware.Middleware
Server is a server auth middleware. Check the token and extract the info from token.
Types ¶
type JwtClaims ¶
func FromContext ¶
FromContext extract auth info from context
Click to show internal directories.
Click to hide internal directories.