Documentation ¶
Overview ¶
Package helper contains helper functions
Package helper provides helper functions
Index ¶
- func GetClaimsFromRefreshToken(refreshToken string) (jwt.MapClaims, error)
- func GetEchoJWTConfig() echojwt.Config
- func GetJWTPublicKey() interface{}
- func GetJWTRefreshSigningKey() interface{}
- func GetJWTSigningKey() interface{}
- func StrPtr2Str(str *string) string
- type JwtClaims
- type TokenDetails
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClaimsFromRefreshToken ¶ added in v0.0.4
GetClaimsFromRefreshToken gets the claims from the refresh token
func GetEchoJWTConfig ¶ added in v0.0.4
GetEchoJWTConfig returns the echo JWT config
func GetJWTPublicKey ¶ added in v0.0.4
func GetJWTPublicKey() interface{}
GetJWTPublicKey gets the JWT public key
func GetJWTRefreshSigningKey ¶ added in v0.0.4
func GetJWTRefreshSigningKey() interface{}
GetJWTRefreshSigningKey gets the JWT refresh signing key
func GetJWTSigningKey ¶ added in v0.0.4
func GetJWTSigningKey() interface{}
GetJWTSigningKey gets the JWT signing key
func StrPtr2Str ¶
Types ¶
type JwtClaims ¶
type JwtClaims struct { UserId int32 `json:"user_id"` Username string `json:"username"` RefreshUUID string `json:"refresh_uuid"` // If 2FA is enabled, this will be false until the user has authenticated with TOTP jwt.RegisteredClaims }
JwtClaims defines the default claims for JWT
func GetClaimsFromContext ¶
func GetClaimsFromContext(c echo.Context) *JwtClaims
GetClaimsFromContext gets the JWT claims from the echo context
type TokenDetails ¶
type TokenDetails struct { AccessToken string RefreshToken string RefreshUUID string AtExpires *jwt.NumericDate RtExpires *jwt.NumericDate }
TokenDetails defines the details of the tokens
func GenerateToken ¶
func GenerateToken(claims *JwtClaims, t time.Time) (*TokenDetails, error)
GenerateToken generates a JWT token
type Validator ¶ added in v0.0.2
type Validator struct {
// contains filtered or unexported fields
}
Validator is a wrapper around the validator package
func NewValidator ¶ added in v0.0.2
func NewValidator() *Validator
NewValidator returns a new Validator
Click to show internal directories.
Click to hide internal directories.