Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService interface { SignUp(ctx context.Context, schema UserSignUpSchema) error SignIn(ctx context.Context, schema UserSignInSchema) (entity.Tokens, error) SignOut(ctx context.Context, userID primitive.ObjectID) error }
AuthService is a service for authorization/authentication
func NewAuthService ¶
func NewAuthService( cache *redis.Client, usersRepo repository.UsersRepository, hasherServ hash.HasherService, jwtServ JWTService, ) (AuthService, error)
type ChangeEmailSchema ¶
type ChangePasswordSchema ¶
type Dependencies ¶
type Dependencies struct { Cache *redis.Client Repos *repository.Repositories HasherService hash.HasherService JWTServiceConfig JWTServiceConfig }
type JWTService ¶
type JWTService interface { CreateTokens(ctx context.Context, userID string) (entity.Tokens, error) ProlongTokens(ctx context.Context, userID string) ParseAccessToken(token string) (*token.JWTCustomClaims, error) ParseRefreshToken(token string) (*token.JWTCustomClaims, error) ValidateAccessToken(ctx context.Context, claims *token.JWTCustomClaims) error ValidateRefreshToken(ctx context.Context, claims *token.JWTCustomClaims) error }
JWTService provides logic for JWT & Refresh tokens generation, parsing and validation.
func NewJWTService ¶
func NewJWTService(cfg JWTServiceConfig, cache *redis.Client) (JWTService, error)
type JWTServiceConfig ¶
type Services ¶
type Services struct { JWT JWTService Auth AuthService Users UsersService }
Services is a collection of all services we have in the project.
func NewServices ¶
func NewServices(deps Dependencies) (*Services, error)
type UserSignInSchema ¶
type UserSignUpSchema ¶
type UsersService ¶
type UsersService interface { GetByID(ctx context.Context, userID primitive.ObjectID) (entity.User, error) ChangeEmail(ctx context.Context, schema ChangeEmailSchema) error ChangePassword(ctx context.Context, schema ChangePasswordSchema) error }
UsersService is a service for users
func NewUsersService ¶
func NewUsersService( usersRepo repository.UsersRepository, hasherServ hash.HasherService, ) (UsersService, error)
Click to show internal directories.
Click to hide internal directories.