Documentation
¶
Index ¶
- Constants
- func ContextWithUser(ctx context.Context, u *models.User) context.Context
- func ContextWithUserId(ctx context.Context, uID int) context.Context
- func ExtractJti(cfg *config.Config, tokenStr string) (string, error)
- func ExtractRefreshTokenHash(cfg *config.Config, tokenStr string) (string, error)
- func ExtractTokenHash(cfg *config.Config, tokenStr string) (string, error)
- func GetRefreshTokenFromRequest(cfg *config.Config, r *http.Request) (string, error)
- func GetTokenFromRequest(cfg *config.Config, r *http.Request) (string, error)
- func UserFromContext(ctx context.Context) (*models.User, error)
- func UserIdFromContext(ctx context.Context) (int, error)
- type AccessToken
- type JWTAuthService
- type KAuthTokenClaims
- type RefreshToken
- type TokenClaims
- type Tokens
Constants ¶
View Source
const ( TokenDuration = time.Hour RefreshTokenDuration = time.Hour * 72 TokenType = "Bearer" )
Variables ¶
This section is empty.
Functions ¶
func ContextWithUserId ¶
TODO: https://www.calhoun.io/pitfalls-of-context-values-and-how-to-avoid-or-mitigate-them/
func ExtractRefreshTokenHash ¶
func GetTokenFromRequest ¶
Types ¶
type AccessToken ¶
type AccessToken struct {
AccessToken string `json:"accessToken"`
}
type JWTAuthService ¶
func NewJWTAuthService ¶
func NewJWTAuthService(jwtCfg *config.JWTConfig, redis *database.RedisDB) JWTAuthService
type KAuthTokenClaims ¶
type RefreshToken ¶
type RefreshToken struct {
RefreshToken string `json:"refreshToken"`
}
type TokenClaims ¶
Click to show internal directories.
Click to hide internal directories.