Documentation
¶
Index ¶
- type BasicAuthStrategy
- type JWTStrategy
- type Service
- func (s *Service) CheckPasswordHash(password, hash string) bool
- func (s *Service) GenerateToken(ctx context.Context, u *dto.UserRead) (string, error)
- func (s *Service) GetCurrentUserId(token *jwt.Token) (userID uuid.UUID, err error)
- func (s *Service) Login(ctx context.Context, identity, password string) (u *dto.UserRead, err error)
- func (s *Service) ValidEmail(email string) bool
- type Strategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicAuthStrategy ¶
type BasicAuthStrategy struct {
// contains filtered or unexported fields
}
BasicAuthStrategy implements AuthStrategy for CLI (no JWT, just password check)
func NewBasicAuthStrategy ¶ added in v1.2.0
func NewBasicAuthStrategy( uow repository.UnitOfWork, logger *slog.Logger, ) *BasicAuthStrategy
func (*BasicAuthStrategy) GenerateToken ¶
func (*BasicAuthStrategy) GetCurrentUserID ¶
type JWTStrategy ¶ added in v1.2.0
type JWTStrategy struct {
// contains filtered or unexported fields
}
JWTStrategy implements AuthStrategy for JWT-based authentication
func NewJWTStrategy ¶ added in v1.2.0
func NewJWTStrategy( uow repository.UnitOfWork, cfg *config.Jwt, logger *slog.Logger, ) *JWTStrategy
func (*JWTStrategy) GenerateToken ¶ added in v1.2.0
func (*JWTStrategy) GetCurrentUserID ¶ added in v1.2.0
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶ added in v1.2.0
func New( uow repository.UnitOfWork, strategy Strategy, logger *slog.Logger, ) *Service
func NewWithBasic ¶ added in v1.2.0
func NewWithBasic( uow repository.UnitOfWork, logger *slog.Logger, ) *Service
func NewWithJWT ¶ added in v1.2.0
func NewWithJWT( uow repository.UnitOfWork, cfg *config.Jwt, logger *slog.Logger, ) *Service
func (*Service) CheckPasswordHash ¶
func (*Service) GenerateToken ¶
func (*Service) GetCurrentUserId ¶
func (*Service) ValidEmail ¶
Click to show internal directories.
Click to hide internal directories.