Documentation ¶
Index ¶
Constants ¶
View Source
const ( TypeTokenAccess = "access_token" TypeTokenRefresh = "refresh_token" )
const
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct { // Algo signing algorithm used for signing. Algo jwt.SigningMethod // SecretKey used for signing. SecretKey []byte // AccessKeyDuration duration (in seconds) for which the jwt access token is valid. AccessDuration time.Duration // RefreshDuration duration (in seconds) for which the jwt refresh token is valid. RefreshDuration time.Duration }
Service provides a Json-Web-Token authentication implementation
func (*Service) GenerateToken ¶
func (j *Service) GenerateToken(input *TokenInput, output *TokenOutput) error
GenerateToken generates new Service token and populates it with user data
func (*Service) MWFunc ¶
func (j *Service) MWFunc() echo.MiddlewareFunc
MWFunc makes JWT implement the Middleware interface.
func (*Service) ParseToken ¶
ParseToken parses token from string
type TokenInput ¶
type TokenInput struct { Type string `json:"type"` // refresh_token or access_token Claims map[string]interface{} `json:"claims"` }
TokenInput represents the input of a token request
type TokenOutput ¶
TokenOutput represents the output of a token request
Click to show internal directories.
Click to hide internal directories.