Documentation
¶
Index ¶
- func CreateAccessToken(id int, uid uuid.UUID) (string, error)
- func JWTAuth(authenticator Authenticator) gin.HandlerFunc
- type AuthClaims
- type Authenticator
- type AuthenticatorImpl
- type UserDto
- type UserService
- type UserServiceImpl
- func (impl *UserServiceImpl) CreateUser(userDto UserDto) (UserDto, error)
- func (impl *UserServiceImpl) FindUserByEmail(email string) (UserDto, error)
- func (impl *UserServiceImpl) GenerateVerificationCode(email, usage string) (string, error)
- func (impl *UserServiceImpl) GetToken(id int, uid uuid.UUID) (string, error)
- func (impl *UserServiceImpl) GetUser(id int) (UserDto, error)
- func (impl *UserServiceImpl) SendSubscriptionEmail(email string) error
- func (impl *UserServiceImpl) UpdateUser(userDto UserDto) (UserDto, error)
- func (impl *UserServiceImpl) ValidateVerificationCode(vCode, vToken, email, usage string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JWTAuth ¶
func JWTAuth(authenticator Authenticator) gin.HandlerFunc
Types ¶
type AuthClaims ¶
type Authenticator ¶
type AuthenticatorImpl ¶
type AuthenticatorImpl struct {
// contains filtered or unexported fields
}
func NewAuthenticatorImpl ¶
func NewAuthenticatorImpl(userRepository repository.UserRepository, logger *zap.SugaredLogger) *AuthenticatorImpl
func (*AuthenticatorImpl) ExtractUserIDFromToken ¶
func (*AuthenticatorImpl) ValidateAccessToken ¶
func (impl *AuthenticatorImpl) ValidateAccessToken(accessToken string) (bool, error)
func (*AuthenticatorImpl) ValidateUser ¶
type UserDto ¶
type UserDto struct {
ID int `json:"-"`
SID string `json:"userId,omitempty"`
UID uuid.UUID `json:"-"`
Nickname string `json:"nickname,omitempty"`
Password string `json:"-"`
Email string `json:"email,omitempty"`
Language string `json:"language,omitempty"`
IsSubscribed bool `json:"-"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
}
type UserService ¶
type UserService interface {
CreateUser(userDto UserDto) (UserDto, error)
UpdateUser(userDto UserDto) (UserDto, error)
FindUserByEmail(email string) (UserDto, error)
GetUser(id int) (UserDto, error)
GetToken(id int, uid uuid.UUID) (string, error)
GenerateVerificationCode(email, usage string) (string, error)
ValidateVerificationCode(vCode, vToken, email, usage string) (bool, error)
SendSubscriptionEmail(email string) error
}
type UserServiceImpl ¶
type UserServiceImpl struct {
// contains filtered or unexported fields
}
func NewUserServiceImpl ¶
func NewUserServiceImpl(userRepository repository.UserRepository, logger *zap.SugaredLogger, smtpServer smtp.SMTPServer) *UserServiceImpl
func (*UserServiceImpl) CreateUser ¶
func (impl *UserServiceImpl) CreateUser(userDto UserDto) (UserDto, error)
func (*UserServiceImpl) FindUserByEmail ¶
func (impl *UserServiceImpl) FindUserByEmail(email string) (UserDto, error)
func (*UserServiceImpl) GenerateVerificationCode ¶
func (impl *UserServiceImpl) GenerateVerificationCode(email, usage string) (string, error)
func (*UserServiceImpl) SendSubscriptionEmail ¶
func (impl *UserServiceImpl) SendSubscriptionEmail(email string) error
func (*UserServiceImpl) UpdateUser ¶
func (impl *UserServiceImpl) UpdateUser(userDto UserDto) (UserDto, error)
func (*UserServiceImpl) ValidateVerificationCode ¶
func (impl *UserServiceImpl) ValidateVerificationCode(vCode, vToken, email, usage string) (bool, error)
Click to show internal directories.
Click to hide internal directories.