Documentation
¶
Index ¶
- func Encode(secret string, alg gojwt.SigningMethod, token Token) (string, error)
- type AuthHandler
- type Config
- type ErrorHandler
- type IdentityHandler
- type Jwt
- func (jwt *Jwt) AuthRequired() echo.HandlerFunc
- func (jwt *Jwt) GenerateAccessToken(identity interface{}) (string, error)
- func (jwt *Jwt) GenerateRefreshToken(identity interface{}) (string, error)
- func (jwt *Jwt) LoginHandler() echo.HandlerFunc
- func (jwt *Jwt) RefreshTokenHandler() echo.HandlerFunc
- func (jwt *Jwt) TokenFromString(tokenString string) (*Token, error)
- type ResponseHandler
- type Token
- type TokenType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthHandler ¶
type Config ¶
type Config struct { UsernameField string PasswordField string IdentityKey string AuthPrefix string AccessExpirationDelta time.Duration RefreshExpirationDelta time.Duration HeaderInvalidHandler ErrorHandler TokenInvalidHandler ErrorHandler TokenExpireHandler ErrorHandler AuthErrorHandler ErrorHandler LoginResponseHandler ResponseHandler RefreshResponseHandler ResponseHandler // contains filtered or unexported fields }
type ErrorHandler ¶
type IdentityHandler ¶
type IdentityHandler func(identity interface{}) interface{}
type Jwt ¶
type Jwt struct {
// contains filtered or unexported fields
}
func NewJwt ¶
func NewJwt(config Config, authenticate AuthHandler, identity IdentityHandler) Jwt
func (*Jwt) AuthRequired ¶
func (jwt *Jwt) AuthRequired() echo.HandlerFunc
Auth required middleware.
func (*Jwt) GenerateAccessToken ¶
Generate access token from identity. Use this method for generating tokens in your handlers.
func (*Jwt) GenerateRefreshToken ¶
Generate refresh token from identity. Use this method for generating tokens in your handlers.
func (*Jwt) LoginHandler ¶
func (jwt *Jwt) LoginHandler() echo.HandlerFunc
Login handler. Override authenticate function and return identity for user.
func (*Jwt) RefreshTokenHandler ¶
func (jwt *Jwt) RefreshTokenHandler() echo.HandlerFunc
Refresh token handler. Use this handler for refreshing access and refresh tokens by old refresh token.
type ResponseHandler ¶
Click to show internal directories.
Click to hide internal directories.