Documentation ¶
Index ¶
- type Authentication
- type AuthenticationPort
- type AuthenticationUsecase
- func (u AuthenticationUsecase) ExtractClaimsForValidToken(token *jwt.Token) (jwt.MapClaims, error)
- func (u AuthenticationUsecase) GenerateJWTTokenPair(user *models.User, signingKeyJWT string) (*models.TokenPair, error)
- func (u AuthenticationUsecase) ParseTokenString(jwtToken, signingKeyJWT string) (*jwt.Token, error)
- type FakeAuthUsecase
- type FakeUserUsecase
- func (f FakeUserUsecase) DeleteUserToken(userId string) error
- func (f FakeUserUsecase) GetUser(name string) (*models.User, error)
- func (f FakeUserUsecase) GetUserById(userId string) (*models.User, error)
- func (f FakeUserUsecase) HasValidPassword(user *models.User, clientPassword string) (bool, error)
- func (f FakeUserUsecase) IsValidUser(userId string) bool
- func (f FakeUserUsecase) StoreUserToken(userId string, tokenPair *models.TokenPair) error
- func (f FakeUserUsecase) UpdataPasswordByUserId(userId, newPasswordHash string) error
- type UserPort
- type UserUsecase
- func (u UserUsecase) DeleteUserToken(userId string) error
- func (u UserUsecase) GetUser(client *models.User) (*models.User, error)
- func (u UserUsecase) GetUserById(userId string) (*models.User, error)
- func (u UserUsecase) HasValidPassword(user *models.User, password string) (bool, error)
- func (u UserUsecase) IsValidUser(userId string) bool
- func (u UserUsecase) StoreUserToken(userId string, tokenPair *models.TokenPair) error
- func (u UserUsecase) UpdataPasswordByUserId(userId, newPasswordHash string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
type Authentication struct {
// contains filtered or unexported fields
}
func NewAuthentication ¶
func NewAuthentication(accessTokenTimeout, refreshTokenTimeout time.Duration) Authentication
func (Authentication) ExtractClaimsForValidToken ¶
func (Authentication) GenerateJWTTokenPair ¶
func (Authentication) ParseTokenString ¶
func (a Authentication) ParseTokenString(jwtToken, signingKeyJWT string) (*jwt.Token, error)
type AuthenticationPort ¶
type AuthenticationUsecase ¶
type AuthenticationUsecase struct {
Auth AuthenticationPort
}
func NewAuthenticationUsecase ¶
func NewAuthenticationUsecase(auth AuthenticationPort) AuthenticationUsecase
func (AuthenticationUsecase) ExtractClaimsForValidToken ¶
func (AuthenticationUsecase) GenerateJWTTokenPair ¶
func (AuthenticationUsecase) ParseTokenString ¶
func (u AuthenticationUsecase) ParseTokenString(jwtToken, signingKeyJWT string) (*jwt.Token, error)
type FakeAuthUsecase ¶
type FakeAuthUsecase struct { HasGenerateJWTTokenPairError bool HasParseTokenStringError bool HasExtractClaimsForValidTokenError bool }
func (FakeAuthUsecase) ExtractClaimsForValidToken ¶
func (FakeAuthUsecase) GenerateJWTTokenPair ¶
func (FakeAuthUsecase) ParseTokenString ¶
func (f FakeAuthUsecase) ParseTokenString(token, signingKeyJWT string) (*jwt.Token, error)
type FakeUserUsecase ¶
type FakeUserUsecase struct { HasGetUserError bool HasGetUserByIdError bool HasUpdatePasswordByUserIdError bool HasDeleteUserTokenError bool HasStoreUserTokenError bool HasValidPasswordError bool IsValidUserError bool }
func (FakeUserUsecase) DeleteUserToken ¶
func (f FakeUserUsecase) DeleteUserToken(userId string) error
func (FakeUserUsecase) GetUser ¶
func (f FakeUserUsecase) GetUser(name string) (*models.User, error)
func (FakeUserUsecase) GetUserById ¶
func (f FakeUserUsecase) GetUserById(userId string) (*models.User, error)
func (FakeUserUsecase) HasValidPassword ¶
func (FakeUserUsecase) IsValidUser ¶
func (f FakeUserUsecase) IsValidUser(userId string) bool
func (FakeUserUsecase) StoreUserToken ¶
func (f FakeUserUsecase) StoreUserToken(userId string, tokenPair *models.TokenPair) error
func (FakeUserUsecase) UpdataPasswordByUserId ¶
func (f FakeUserUsecase) UpdataPasswordByUserId(userId, newPasswordHash string) error
type UserPort ¶
type UserPort interface { DeleteUserToken(userId string) error GetUser(name string) (*models.User, error) GetUserById(userId string) (*models.User, error) UpdataPasswordByUserId(userId, newPasswordHash string) error HasValidPassword(user *models.User, clientPassword string) (bool, error) IsValidUser(userId string) bool StoreUserToken(userId string, tokenPair *models.TokenPair) error }
type UserUsecase ¶
type UserUsecase struct {
// contains filtered or unexported fields
}
func NewUserUsecase ¶
func NewUserUsecase(repository UserPort) UserUsecase
func (UserUsecase) DeleteUserToken ¶
func (u UserUsecase) DeleteUserToken(userId string) error
func (UserUsecase) GetUserById ¶
func (u UserUsecase) GetUserById(userId string) (*models.User, error)
func (UserUsecase) HasValidPassword ¶
func (UserUsecase) IsValidUser ¶
func (u UserUsecase) IsValidUser(userId string) bool
func (UserUsecase) StoreUserToken ¶
func (u UserUsecase) StoreUserToken(userId string, tokenPair *models.TokenPair) error
func (UserUsecase) UpdataPasswordByUserId ¶
func (u UserUsecase) UpdataPasswordByUserId(userId, newPasswordHash string) error
Click to show internal directories.
Click to hide internal directories.