auth

package
v1.14.19 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountIdentityStore added in v1.14.18

type AccountIdentityStore interface {
	UserAuth() repository.UserAuthRepo
}

AccountIdentityStore is the persistence surface used by account existence checks. It excludes unrelated application repositories.

type BindDeviceDependencies added in v1.14.18

type BindDeviceDependencies struct {
	Store BindDeviceStore
}

BindDeviceDependencies explicitly declares the collaborators of device binding instead of passing ServiceContext to business logic.

type BindDeviceLogic added in v1.1.8

type BindDeviceLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewBindDeviceLogic added in v1.1.8

func NewBindDeviceLogic(ctx context.Context, deps BindDeviceDependencies) *BindDeviceLogic

func (*BindDeviceLogic) BindDeviceToUser added in v1.1.8

func (l *BindDeviceLogic) BindDeviceToUser(identifier, ip, userAgent string, currentUserId int64) error

BindDeviceToUser binds a device to a user If the device is already bound to another user, it will disable that user and bind the device to the current user

type BindDeviceStore added in v1.14.18

type BindDeviceStore interface {
	User() repository.UserRepo
	UserAuth() repository.UserAuthRepo
	UserDevice() repository.UserDeviceRepo
	InTx(ctx context.Context, fn func(repository.Store) error) error
}

BindDeviceStore is the persistence surface used by device binding. It excludes unrelated application repositories.

type CheckUserDependencies added in v1.14.18

type CheckUserDependencies struct {
	Store AccountIdentityStore
}

CheckUserDependencies explicitly declares the collaborators of account existence checks instead of passing ServiceContext to business logic.

type CheckUserLogic

type CheckUserLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewCheckUserLogic

func NewCheckUserLogic(ctx context.Context, deps CheckUserDependencies) *CheckUserLogic

NewCheckUserLogic Check user is exist

func (*CheckUserLogic) CheckUser

func (l *CheckUserLogic) CheckUser(req *dto.CheckUserRequest) (resp *dto.CheckUserResponse, err error)

type CheckUserTelephoneLogic

type CheckUserTelephoneLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewCheckUserTelephoneLogic

func NewCheckUserTelephoneLogic(ctx context.Context, deps CheckUserDependencies) *CheckUserTelephoneLogic

Check user telephone is exist

func (*CheckUserTelephoneLogic) CheckUserTelephone

type DeviceBinder added in v1.14.18

type DeviceBinder interface {
	BindDeviceToUser(identifier, ip, userAgent string, currentUserID int64) error
}

DeviceBinder attaches a device identifier to a newly registered user.

type DeviceLoginConfig added in v1.14.18

type DeviceLoginConfig struct {
	Enabled           bool
	OnlyRealDevice    bool
	InviteForced      bool
	OnlyFirstPurchase bool
	TrialEnabled      bool
	TrialSubscribeID  int64
	TrialTime         int64
	TrialTimeUnit     string
	JWTAccessSecret   string
	JWTAccessExpire   int64
}

DeviceLoginConfig is the configuration snapshot consumed by the device login and registration use case.

type DeviceLoginDependencies added in v1.14.18

type DeviceLoginDependencies struct {
	Store  DeviceLoginStore
	Redis  *redis.Client
	Config DeviceLoginConfig
	Policy DeviceRegistrationPolicy
}

DeviceLoginDependencies explicitly declares the collaborators required by device login instead of passing ServiceContext to business logic.

type DeviceLoginLogic added in v1.1.8

type DeviceLoginLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewDeviceLoginLogic added in v1.1.8

func NewDeviceLoginLogic(ctx context.Context, deps DeviceLoginDependencies) *DeviceLoginLogic

Device Login

func (*DeviceLoginLogic) DeviceLogin added in v1.1.8

func (l *DeviceLoginLogic) DeviceLogin(req *dto.DeviceLoginRequest) (resp *dto.LoginResponse, err error)

type DeviceLoginStore added in v1.14.18

type DeviceLoginStore interface {
	User() repository.UserRepo
	UserAuth() repository.UserAuthRepo
	UserDevice() repository.UserDeviceRepo
	UserSubscription() repository.UserSubscriptionRepo
	UserCache() repository.UserCacheRepo
	Subscribe() repository.SubscribeRepo
	Log() repository.LogRepo
	InTx(ctx context.Context, fn func(repository.Store) error) error
}

DeviceLoginStore is the persistence surface used by device login and device registration. It excludes unrelated application repositories.

type DeviceRegistrationPolicy added in v1.14.18

type DeviceRegistrationPolicy interface {
	EnsureRegistrationOpen(ctx context.Context, method string) error
	VerifyHuman(ctx context.Context, token, ip string) error
	TakeIPPermit(ctx context.Context, ip string) error
}

DeviceRegistrationPolicy contains the registration checks needed when a previously unseen device creates an account.

type EmailLoginPolicy added in v1.14.18

type EmailLoginPolicy interface {
	EnsureMethodEnabled(ctx context.Context, method string) error
}

EmailLoginPolicy contains the authentication-method policy required by email login.

type EmailPasswordResetPolicy added in v1.14.18

type EmailPasswordResetPolicy interface {
	EnsureMethodEnabled(ctx context.Context, method string) error
}

EmailPasswordResetPolicy contains the authentication-method policy required by email password reset.

type EmailRegistrationPolicy added in v1.14.18

type EmailRegistrationPolicy interface {
	EnsureRegistrationOpen(ctx context.Context, method string) error
	VerifyHuman(ctx context.Context, token, ip string) error
	TakeIPPermit(ctx context.Context, ip string) error
}

EmailRegistrationPolicy contains the registration checks required by email registration.

type ResetPasswordConfig added in v1.14.18

type ResetPasswordConfig struct {
	JWTAccessSecret string
	JWTAccessExpire int64
}

ResetPasswordConfig is the configuration snapshot consumed by email password reset.

type ResetPasswordDependencies added in v1.14.18

type ResetPasswordDependencies struct {
	Store        ResetPasswordStore
	Redis        *redis.Client
	Config       ResetPasswordConfig
	Policy       EmailPasswordResetPolicy
	DeviceBinder DeviceBinder
}

ResetPasswordDependencies explicitly declares the collaborators of email password reset instead of passing ServiceContext to business logic.

type ResetPasswordLogic

type ResetPasswordLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewResetPasswordLogic

func NewResetPasswordLogic(ctx context.Context, deps ResetPasswordDependencies) *ResetPasswordLogic

NewResetPasswordLogic Reset password

func (*ResetPasswordLogic) ResetPassword

func (l *ResetPasswordLogic) ResetPassword(req *dto.ResetPasswordRequest) (resp *dto.LoginResponse, err error)

type ResetPasswordStore added in v1.14.18

type ResetPasswordStore interface {
	User() repository.UserRepo
	UserAuth() repository.UserAuthRepo
	Log() repository.LogRepo
}

ResetPasswordStore is the persistence surface used by email password reset. It excludes unrelated application repositories.

type TelephoneLoginConfig added in v1.14.18

type TelephoneLoginConfig struct {
	JWTAccessSecret string
	JWTAccessExpire int64
}

TelephoneLoginConfig is the configuration snapshot consumed by telephone login.

type TelephoneLoginDependencies added in v1.14.18

type TelephoneLoginDependencies struct {
	Store        TelephoneLoginStore
	Redis        *redis.Client
	Config       TelephoneLoginConfig
	Policy       TelephoneLoginPolicy
	DeviceBinder DeviceBinder
}

TelephoneLoginDependencies explicitly declares the collaborators of telephone login instead of passing ServiceContext to business logic.

type TelephoneLoginLogic

type TelephoneLoginLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewTelephoneLoginLogic

func NewTelephoneLoginLogic(ctx context.Context, deps TelephoneLoginDependencies) *TelephoneLoginLogic

User Telephone login

func (*TelephoneLoginLogic) TelephoneLogin

func (l *TelephoneLoginLogic) TelephoneLogin(req *dto.TelephoneLoginRequest, ip, userAgent string) (resp *dto.LoginResponse, err error)

type TelephoneLoginPolicy added in v1.14.18

type TelephoneLoginPolicy interface {
	EnsureMethodEnabled(ctx context.Context, method string) error
}

TelephoneLoginPolicy contains the authentication-method policy required by telephone login.

type TelephoneLoginStore added in v1.14.18

type TelephoneLoginStore interface {
	User() repository.UserRepo
	UserAuth() repository.UserAuthRepo
	Log() repository.LogRepo
}

TelephoneLoginStore is the persistence surface used by telephone login. It excludes unrelated application repositories.

type TelephonePasswordResetPolicy added in v1.14.18

type TelephonePasswordResetPolicy interface {
	EnsureMethodEnabled(ctx context.Context, method string) error
}

TelephonePasswordResetPolicy contains the authentication-method policy required by telephone password reset.

type TelephoneRegistrationPolicy added in v1.14.18

type TelephoneRegistrationPolicy interface {
	EnsureRegistrationOpen(ctx context.Context, method string) error
	VerifyHuman(ctx context.Context, token, ip string) error
	TakeIPPermit(ctx context.Context, ip string) error
}

TelephoneRegistrationPolicy contains the registration checks required by telephone registration.

type TelephoneResetPasswordConfig added in v1.14.18

type TelephoneResetPasswordConfig struct {
	JWTAccessSecret string
	JWTAccessExpire int64
}

TelephoneResetPasswordConfig is the configuration snapshot consumed by telephone password reset.

type TelephoneResetPasswordDependencies added in v1.14.18

type TelephoneResetPasswordDependencies struct {
	Store        TelephoneResetPasswordStore
	Redis        *redis.Client
	Config       TelephoneResetPasswordConfig
	Policy       TelephonePasswordResetPolicy
	DeviceBinder DeviceBinder
}

TelephoneResetPasswordDependencies explicitly declares the collaborators of telephone password reset instead of passing ServiceContext to business logic.

type TelephoneResetPasswordLogic

type TelephoneResetPasswordLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewTelephoneResetPasswordLogic

func NewTelephoneResetPasswordLogic(ctx context.Context, deps TelephoneResetPasswordDependencies) *TelephoneResetPasswordLogic

Reset password

func (*TelephoneResetPasswordLogic) TelephoneResetPassword

func (l *TelephoneResetPasswordLogic) TelephoneResetPassword(req *dto.TelephoneResetPasswordRequest) (resp *dto.LoginResponse, err error)

type TelephoneResetPasswordStore added in v1.14.18

type TelephoneResetPasswordStore interface {
	User() repository.UserRepo
	UserAuth() repository.UserAuthRepo
	Log() repository.LogRepo
}

TelephoneResetPasswordStore is the persistence surface used by telephone password reset. It excludes unrelated application repositories.

type TelephoneUserRegisterConfig added in v1.14.18

type TelephoneUserRegisterConfig struct {
	InviteForced      bool
	OnlyFirstPurchase bool
	TrialEnabled      bool
	TrialSubscribeID  int64
	TrialTime         int64
	TrialTimeUnit     string
	JWTAccessSecret   string
	JWTAccessExpire   int64
}

TelephoneUserRegisterConfig is the configuration snapshot consumed by telephone registration.

type TelephoneUserRegisterDependencies added in v1.14.18

type TelephoneUserRegisterDependencies struct {
	Store        TelephoneUserRegisterStore
	Redis        *redis.Client
	Config       TelephoneUserRegisterConfig
	Policy       TelephoneRegistrationPolicy
	DeviceBinder DeviceBinder
}

TelephoneUserRegisterDependencies explicitly declares the collaborators of telephone registration instead of passing ServiceContext to business logic.

type TelephoneUserRegisterLogic

type TelephoneUserRegisterLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewTelephoneUserRegisterLogic

func NewTelephoneUserRegisterLogic(ctx context.Context, deps TelephoneUserRegisterDependencies) *TelephoneUserRegisterLogic

NewTelephoneUserRegisterLogic User Telephone register

func (*TelephoneUserRegisterLogic) TelephoneUserRegister

func (l *TelephoneUserRegisterLogic) TelephoneUserRegister(req *dto.TelephoneRegisterRequest) (resp *dto.LoginResponse, err error)

type TelephoneUserRegisterStore added in v1.14.18

type TelephoneUserRegisterStore interface {
	User() repository.UserRepo
	UserAuth() repository.UserAuthRepo
	UserSubscription() repository.UserSubscriptionRepo
	UserCache() repository.UserCacheRepo
	Subscribe() repository.SubscribeRepo
	Log() repository.LogRepo
	InTx(ctx context.Context, fn func(repository.Store) error) error
}

TelephoneUserRegisterStore is the persistence surface used by telephone registration. It excludes unrelated application repositories.

type UserLoginConfig added in v1.14.18

type UserLoginConfig struct {
	JWTAccessSecret string
	JWTAccessExpire int64
}

UserLoginConfig is the configuration snapshot consumed by email login.

type UserLoginDependencies added in v1.14.18

type UserLoginDependencies struct {
	Store        UserLoginStore
	Redis        *redis.Client
	Config       UserLoginConfig
	Policy       EmailLoginPolicy
	DeviceBinder DeviceBinder
}

UserLoginDependencies explicitly declares the collaborators of email login instead of passing ServiceContext to business logic.

type UserLoginLogic

type UserLoginLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewUserLoginLogic

func NewUserLoginLogic(ctx context.Context, deps UserLoginDependencies) *UserLoginLogic

NewUserLoginLogic User login

func (*UserLoginLogic) UserLogin

func (l *UserLoginLogic) UserLogin(req *dto.UserLoginRequest) (resp *dto.LoginResponse, err error)

type UserLoginStore added in v1.14.18

type UserLoginStore interface {
	User() repository.UserRepo
	Log() repository.LogRepo
}

UserLoginStore is the persistence surface used by email login. It excludes unrelated application repositories.

type UserRegisterConfig added in v1.14.18

type UserRegisterConfig struct {
	EmailDomainSuffixList   string
	EmailEnableDomainSuffix bool
	EmailVerifyEnabled      bool
	InviteForced            bool
	OnlyFirstPurchase       bool
	TrialEnabled            bool
	TrialSubscribeID        int64
	TrialTime               int64
	TrialTimeUnit           string
	JWTAccessSecret         string
	JWTAccessExpire         int64
}

UserRegisterConfig is the configuration snapshot consumed by email registration.

type UserRegisterDependencies added in v1.14.18

type UserRegisterDependencies struct {
	Store        UserRegisterStore
	Redis        *redis.Client
	Config       UserRegisterConfig
	Policy       EmailRegistrationPolicy
	DeviceBinder DeviceBinder
}

UserRegisterDependencies explicitly declares the collaborators of email registration instead of passing ServiceContext to business logic.

type UserRegisterLogic

type UserRegisterLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func NewUserRegisterLogic

func NewUserRegisterLogic(ctx context.Context, deps UserRegisterDependencies) *UserRegisterLogic

NewUserRegisterLogic User register

func (*UserRegisterLogic) UserRegister

func (l *UserRegisterLogic) UserRegister(req *dto.UserRegisterRequest) (resp *dto.LoginResponse, err error)

type UserRegisterStore added in v1.14.18

type UserRegisterStore interface {
	User() repository.UserRepo
	UserAuth() repository.UserAuthRepo
	UserSubscription() repository.UserSubscriptionRepo
	UserCache() repository.UserCacheRepo
	Subscribe() repository.SubscribeRepo
	Log() repository.LogRepo
	InTx(ctx context.Context, fn func(repository.Store) error) error
}

UserRegisterStore is the persistence surface used by email registration. It excludes unrelated application repositories.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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