auth

package
v0.0.0-rc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateUser       = dto2.NewI18nError("duplicate user", "errors.duplicate_user")
	ErrInvalidOrExpiredOtp = dto2.NewI18nError("OTP is invalid or has expired", "errors.invalid_or_expired_otp")
	ErrBadCredentials      = dto2.NewI18nError("bad credentials", "errors.bad_credentials")
	ErrUserIsBlocked       = dto2.NewI18nError("user is blocked", "errors.user_is_blocked")
	ErrUserNotFound        = dto2.NewI18nError("user not found", "errors.user_not_found")
	ErrInvalidJwtToken     = dto2.NewI18nError("invalid JWT token", "errors.invalid_jwt_token")
	ErrUserInfoNotReceived = dto2.NewI18nError("user info not received", "errors.userinfo_not_received")
	ErrInvalidProvider     = dto2.NewI18nError("invalid provider", "errors.invalid_provider")
	ErrSendEmail           = dto2.NewI18nError("failed to send email", "errors.failed_to_send_email")
)

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(
	userRepo repo.UserRepository,
	bannedTokenRepo repo.BannedTokenRepository,
	oauthProviders map[string]oauth.Provider,
	cacheManager cache2.Manager,
	smtpSender smtp.Sender,
	templateEngine template.Engine,
	cfg *config.Config,
) *Service

func (*Service) FetchUserInfo

func (s *Service) FetchUserInfo(ctx context.Context, provider string, input dto.FetchUserInfoInput) (
	oauth.UserInfo, error,
)

func (*Service) GetConsentPageUrl

func (s *Service) GetConsentPageUrl(_ context.Context, provider string, redirectUrl string) (dto.GetConsentPageUrlOutput, error)

func (*Service) Login

func (s *Service) Login(ctx context.Context, input dto.LoginInput) (dto.JwtTokensOutput, error)

func (*Service) Logout

func (s *Service) Logout(ctx context.Context, jti string) error

func (*Service) RecoveryPassword

func (s *Service) RecoveryPassword(ctx context.Context, input dto.RecoveryPasswordInput, localizer *i18n.Localizer) error

func (*Service) RefreshTokens

func (s *Service) RefreshTokens(ctx context.Context, refreshToken string) (dto.JwtTokensOutput, error)

func (*Service) Register

func (s *Service) Register(ctx context.Context, input dto.RegisterInput, localizer *i18n.Localizer) error

func (*Service) RegisterConfirm

func (s *Service) RegisterConfirm(ctx context.Context, input dto.RegisterConfirmInput) error

func (*Service) RegisterOrLogin

func (s *Service) RegisterOrLogin(ctx context.Context, userInfo oauth.UserInfo) (dto.JwtTokensOutput, error)

func (*Service) ResetPassword

func (s *Service) ResetPassword(ctx context.Context, input dto.ResetPasswordInput) error

func (*Service) VerifyRecoveryCode

func (s *Service) VerifyRecoveryCode(ctx context.Context, input dto.VerifyRecoveryCodeInput) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL