Versions in this module Expand all Collapse all v0 v0.5.0 Jul 6, 2024 Changes in this version + var AccessTokenDuration time.Duration = time.Minute * 15 + var ErrIncorrectPassword = errors.New("password is incorrect") + var ErrNotAuthorized = errors.New("not authorized") + var ErrUserNotFound = errors.New("user not found") + var RefreshTokenDuration time.Duration = time.Hour * 24 * 21 + type AuthService interface + Authorize func(ctx context.Context, tokens *TokenPair) (*TokenPair, string, error) + LogIn func(ctx context.Context, username, password string) (*TokenPair, error) + LogOut func(ctx context.Context, tokens *TokenPair) error + func NewAuthService(jwtSecretKey string, blacklistStore BlacklistStore, ...) AuthService + type BlacklistStore interface + Exists func(ctx context.Context, key string) (bool, error) + Set func(ctx context.Context, key, value string, expiration time.Duration) error + type TokenPair struct + AccessToken string + RefreshToken string + type UsersProvider interface + Exists func(ctx context.Context, username string) (bool, error) + GetPasswordHash func(ctx context.Context, username string) (string, error)