Versions in this module Expand all Collapse all v1 v1.0.3 May 9, 2024 v1.0.2 Dec 11, 2023 Changes in this version + var ErrAlgoInvalid = errors.New("jwtauth: algorithm mismatch") + var ErrExpired = errors.New("jwtauth: token is expired") + var ErrIATInvalid = errors.New("jwtauth: token iat validation failed") + var ErrNBFInvalid = errors.New("jwtauth: token nbf validation failed") + var ErrNoTokenFound = errors.New("jwtauth: no token found") + var ErrUnauthorized = errors.New("jwtauth: token is unauthorized") + var ErrorCtxKey = &contextKey + var TokenCtxKey = &contextKey + func Authenticator(next http.Handler) http.Handler + func EpochNow() int64 + func ExpireIn(tm time.Duration) int64 + func FromContext(ctx context.Context) (*jwt.Token, jwt.MapClaims, error) + func NewContext(ctx context.Context, t *jwt.Token, err error) context.Context + func SetExpiry(claims jwt.MapClaims, tm time.Time) + func SetExpiryIn(claims jwt.MapClaims, tm time.Duration) + func SetIssuedAt(claims jwt.MapClaims, tm time.Time) + func SetIssuedNow(claims jwt.MapClaims) + func TokenFromCookie(r *http.Request) string + func TokenFromHeader(r *http.Request) string + func TokenFromQuery(r *http.Request) string + func UnixTime(tm time.Time) int64 + func Verifier(ja *JWTAuth) func(http.Handler) http.Handler + func Verify(ja *JWTAuth, findTokenFns ...func(r *http.Request) string) func(http.Handler) http.Handler + func VerifyRequest(ja *JWTAuth, r *http.Request, findTokenFns ...func(r *http.Request) string) (*jwt.Token, error) + type JWTAuth struct + SignKey interface{} + Signer jwt.SigningMethod + func New(alg string, signKey interface{}, verifyKey interface{}) *JWTAuth + func NewWithParser(alg string, parser *jwt.Parser, signKey interface{}, verifyKey interface{}) *JWTAuth + func (ja *JWTAuth) Decode(tokenString string) (t *jwt.Token, err error) + func (ja *JWTAuth) Encode(claims jwt.Claims) (t *jwt.Token, tokenString string, err error)