Documentation ¶
Index ¶
- func NewCode(user models.User, Action models.KindCode, Data string) *models.Code
- func NewUser(Email, PasswordHash string) *models.User
- type AccessTokenCache
- type AccessTokenClaims
- type CodeService
- type CodeServiceImpl
- type RefreshTokenClaims
- type TokenDetails
- type TokenService
- type TokenServiceImpl
- func (r *TokenServiceImpl) CreateToken(userUuid string, userRole string) (*TokenDetails, error)
- func (r *TokenServiceImpl) DecodeAccessToken(tokenString string) (*AccessTokenClaims, error)
- func (r *TokenServiceImpl) DecodeRefreshToken(tokenString string) (*RefreshTokenClaims, error)
- func (r *TokenServiceImpl) DropCacheKey(Uuid string) error
- func (r *TokenServiceImpl) DropCacheTokens(accessTokenClaims AccessTokenClaims) error
- func (r *TokenServiceImpl) GetAccessSecret() string
- func (r *TokenServiceImpl) GetCacheValue(Uuid string) (*string, error)
- type UserService
- type UserServiceImpl
- func (us *UserServiceImpl) CheckPassword(user *models.User, password string) (bool, error)
- func (us *UserServiceImpl) Confirm(code *models.Code) error
- func (us *UserServiceImpl) GetActiveUserByEmail(email string) (*models.User, error)
- func (us *UserServiceImpl) GetUserByUuid(uuidStr string) (*models.User, error)
- func (us *UserServiceImpl) RegisterCustomer(email, password, clientIp string) error
- func (us *UserServiceImpl) ResetPassword(email, password string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessTokenCache ¶
type AccessTokenClaims ¶
type CodeServiceImpl ¶
type CodeServiceImpl struct {
// contains filtered or unexported fields
}
func NewCodeServiceImpl ¶
func NewCodeServiceImpl(codeRepo models.CodeRepository) *CodeServiceImpl
type RefreshTokenClaims ¶
type TokenDetails ¶
type TokenDetails struct { AccessToken string RefreshToken string AccessUuid uuid.UUID RefreshUuid uuid.UUID AtExpires int64 RtExpires int64 }
TokenDetails is the structure which holds data with JWT tokens
type TokenService ¶
type TokenService interface { GetAccessSecret() string CreateToken(userUuid string, userRole string) (*TokenDetails, error) DecodeRefreshToken(tokenString string) (*RefreshTokenClaims, error) DecodeAccessToken(tokenString string) (*AccessTokenClaims, error) DropCacheTokens(accessTokenClaims AccessTokenClaims) error DropCacheKey(Uuid string) error GetCacheValue(Uuid string) (*string, error) }
type TokenServiceImpl ¶
type TokenServiceImpl struct {
// contains filtered or unexported fields
}
func NewTokenServiceImpl ¶
func NewTokenServiceImpl(cache *redis.Client, accessSecret string, refreshSecret string, accessExpMinutes int, refreshExpMinutes int) *TokenServiceImpl
func (*TokenServiceImpl) CreateToken ¶
func (r *TokenServiceImpl) CreateToken(userUuid string, userRole string) (*TokenDetails, error)
CreateToken returns JWT Token
func (*TokenServiceImpl) DecodeAccessToken ¶
func (r *TokenServiceImpl) DecodeAccessToken(tokenString string) (*AccessTokenClaims, error)
func (*TokenServiceImpl) DecodeRefreshToken ¶
func (r *TokenServiceImpl) DecodeRefreshToken(tokenString string) (*RefreshTokenClaims, error)
func (*TokenServiceImpl) DropCacheKey ¶
func (r *TokenServiceImpl) DropCacheKey(Uuid string) error
DropCacheKey function that will be used to drop the JWTs metadata from Redis
func (*TokenServiceImpl) DropCacheTokens ¶
func (r *TokenServiceImpl) DropCacheTokens(accessTokenClaims AccessTokenClaims) error
func (*TokenServiceImpl) GetAccessSecret ¶
func (r *TokenServiceImpl) GetAccessSecret() string
func (*TokenServiceImpl) GetCacheValue ¶
func (r *TokenServiceImpl) GetCacheValue(Uuid string) (*string, error)
GetCacheValue function that will be used to get the JWTs metadata from Redis
type UserService ¶
type UserService interface { RegisterCustomer(email, password, clientIp string) error Confirm(code *models.Code) error ResetPassword(email, password string) error CheckPassword(user *models.User, password string) (bool, error) GetActiveUserByEmail(email string) (*models.User, error) GetUserByUuid(uuid string) (*models.User, error) }
type UserServiceImpl ¶
type UserServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserServiceImpl ¶
func NewUserServiceImpl(codeRepo models.CodeRepository, userRepo models.UserRepository, checkmailRPC *RPCServices.CheckmailRPC, mailRPC *RPCServices.MailRPC, customerRPC *RPCServices.CustomerRPC) *UserServiceImpl
func (*UserServiceImpl) CheckPassword ¶
func (*UserServiceImpl) GetActiveUserByEmail ¶
func (us *UserServiceImpl) GetActiveUserByEmail(email string) (*models.User, error)
func (*UserServiceImpl) GetUserByUuid ¶
func (us *UserServiceImpl) GetUserByUuid(uuidStr string) (*models.User, error)
func (*UserServiceImpl) RegisterCustomer ¶
func (us *UserServiceImpl) RegisterCustomer(email, password, clientIp string) error
func (*UserServiceImpl) ResetPassword ¶
func (us *UserServiceImpl) ResetPassword(email, password string) error
Click to show internal directories.
Click to hide internal directories.