Versions in this module Expand all Collapse all v1 v1.0.1 Jul 6, 2016 Changes in this version + type Login struct + Password string + Username string v1.0.0 Jul 24, 2020 Changes in this version + var ErrEmptyAuthHeader = errors.New("auth header is empty") + var ErrEmptyCookieToken = errors.New("cookie token is empty") + var ErrEmptyParamToken = errors.New("parameter token is empty") + var ErrEmptyQueryToken = errors.New("query token is empty") + var ErrExpiredToken = errors.New("token is expired") + var ErrFailedAuthentication = errors.New("incorrect Username or Password") + var ErrFailedTokenCreation = errors.New("failed to create JWT Token") + var ErrForbidden = errors.New("you don't have permission to access this resource") + var ErrInvalidAuthHeader = errors.New("auth header is invalid") + var ErrInvalidPrivKey = errors.New("private key invalid") + var ErrInvalidPubKey = errors.New("public key invalid") + var ErrInvalidSigningAlgorithm = errors.New("invalid signing algorithm") + var ErrMissingAuthenticatorFunc = errors.New("ginJWTMiddleware.Authenticator func is undefined") + var ErrMissingExpField = errors.New("missing exp field") + var ErrMissingLoginValues = errors.New("missing Username or Password") + var ErrMissingSecretKey = errors.New("secret key is required") + var ErrNoPrivKeyFile = errors.New("private key file unreadable") + var ErrNoPubKeyFile = errors.New("public key file unreadable") + var ErrWrongFormatOfExp = errors.New("exp must be float64 format") + var IdentityKey = "identity" + func GetToken(c *gin.Context) string + type GinJWTMiddleware struct + Authenticator func(c *gin.Context) (interface{}, error) + Authorizator func(data interface{}, c *gin.Context) bool + CookieDomain string + CookieHTTPOnly bool + CookieMaxAge time.Duration + CookieName string + CookieSameSite http.SameSite + DisabledAbort bool + HTTPStatusMessageFunc func(e error, c *gin.Context) string + IdentityHandler func(*gin.Context) interface{} + IdentityKey string + Key []byte + LoginResponse func(*gin.Context, int, string, time.Time) + LogoutResponse func(*gin.Context, int) + MaxRefresh time.Duration + PayloadFunc func(data interface{}) MapClaims + PrivKeyFile string + PubKeyFile string + Realm string + RefreshResponse func(*gin.Context, int, string, time.Time) + SecureCookie bool + SendAuthorization bool + SendCookie bool + SigningAlgorithm string + TimeFunc func() time.Time + Timeout time.Duration + TokenHeadName string + TokenLookup string + Unauthorized func(*gin.Context, int, string) + func New(m *GinJWTMiddleware) (*GinJWTMiddleware, error) + func (mw *GinJWTMiddleware) CheckIfTokenExpire(c *gin.Context) (jwt.MapClaims, error) + func (mw *GinJWTMiddleware) GetClaimsFromJWT(c *gin.Context) (MapClaims, error) + func (mw *GinJWTMiddleware) LoginHandler(c *gin.Context) + func (mw *GinJWTMiddleware) LogoutHandler(c *gin.Context) + func (mw *GinJWTMiddleware) MiddlewareFunc() gin.HandlerFunc + func (mw *GinJWTMiddleware) MiddlewareImpl(c *gin.Context) + func (mw *GinJWTMiddleware) MiddlewareInit() error + func (mw *GinJWTMiddleware) ParseToken(c *gin.Context) (*jwt.Token, error) + func (mw *GinJWTMiddleware) ParseTokenString(token string) (*jwt.Token, error) + func (mw *GinJWTMiddleware) RefreshHandler(c *gin.Context) + func (mw *GinJWTMiddleware) RefreshToken(c *gin.Context) (string, time.Time, error) + func (mw *GinJWTMiddleware) TokenGenerator(data interface{}) (string, time.Time, error) + type MapClaims map[string]interface + func ExtractClaims(c *gin.Context) MapClaims + func ExtractClaimsFromToken(token *jwt.Token) MapClaims