Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTokenRevoked = errors.NewHTTP(http.StatusUnauthorized, "token is revoked") ErrTokenMalformed = errors.NewHTTP(http.StatusUnauthorized, "malformed token") ErrTokenExpired = errors.NewHTTP(http.StatusUnauthorized, "token is expired") ErrTokenNotValidYet = errors.NewHTTP(http.StatusUnauthorized, "token is not active yet") ErrAuthTokenMissed = errors.NewHTTP(http.StatusUnauthorized, "missed authorization token") ErrBlacklistNotSpecified = errors.New("blacklist adapter is not specified") ErrUnexpectedSigningMethod = errors.New("unexpected signing method") ErrCouldNotRefresh = errors.NewHTTP(http.StatusUnauthorized, "could not refresh token, log in again") )
Predefined JWT errors
Functions ¶
This section is empty.
Types ¶
type DefaultClaims ¶
type DefaultClaims struct {
UserID string `json:"uid,omitempty"`
ApplicationID string `json:"aid,omitempty"`
Role string `json:"rol,omitempty"`
jwt.StandardClaims
}
DefaultClaims struct
func (DefaultClaims) ExpAt ¶
func (c DefaultClaims) ExpAt() int64
ExpAt getter function returns expiration time in seconds
type Interactor ¶
type Interactor interface {
New(uid, aid, role string) (string, error)
NewWithClaims(Claims) (string, error)
Parse(token string, claims Claims) error
ParseFromRequest(r *http.Request, claims Claims) error
ParseExpired(tokenString string, claims Claims) error
GetTokenStringFromRequest(r *http.Request) (string, error)
Revoke(tokenID string) error
IsRevoked(tokenID string) bool
RefreshToken(claims Claims) (string, error)
RefreshTokenFromString(tokenString string) (string, error)
}
Interactor interface
func NewInteractor ¶
func NewInteractor(signingKey string, ttl, refreshTTL int64, bl blacklist.Blacklist) (Interactor, error)
NewInteractor factory
Click to show internal directories.
Click to hide internal directories.