Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultAccessTokenDuration = time.Hour * 24 DefaultRefreshTokenDuration = time.Hour * 24 * 30 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { JwtSecretKey string `env:"JWT_SECRET_KEY"` JwtSigningMethod string `env:"JWT_SIGNING_METHOD" envDefault:"HS512"` // default: 15 minutes JwtAccessTokenDurationInSeconds TokenDuration `env:"JWT_ACCESS_TOKEN_DURATION" envDefault:"86400"` JwtRefreshTokenDurationInSeconds TokenDuration `env:"JWT_REFRESH_TOKEN_DURATION" envDefault:"2592000"` }
type JwtToken ¶
type JwtToken interface { SetSecretKey(secretKey []byte, signMethod jwt.SigningMethod) CreateAccessToken(context.Context, model.SessionUser) (string, *time.Time, error) CreateRefreshToken(context.Context, model.SessionUser) (string, *time.Time, error) CreateTokenCustomDuration(context.Context, model.SessionUser, time.Duration) (string, *time.Time, error) Parse(ctx context.Context, tokenString string) (*model.SessionUser, error) }
type SessionUserClaims ¶
type SessionUserClaims struct { UID uuid.UUID `json:"uid,omitempty"` Email string `json:"email,omitempty"` jwt.RegisteredClaims }
type TokenDuration ¶
func (*TokenDuration) UnmarshalText ¶
func (receiver *TokenDuration) UnmarshalText(text []byte) error
Click to show internal directories.
Click to hide internal directories.