Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateOtp() (string, error)
- func NewUserRoleChangeEventHandler(um *UserManager) event.ConsumerHandler
- type DefaultEmailSender
- type DefaultOtpTokenProvider
- type EmailSender
- type EmailTokenProvider
- func (e *EmailTokenProvider) CanGenerate(ctx context.Context, user *User) error
- func (e *EmailTokenProvider) Generate(ctx context.Context, purpose TokenPurpose, user *User, duration time.Duration) (string, error)
- func (e *EmailTokenProvider) Name() string
- func (e *EmailTokenProvider) Validate(ctx context.Context, purpose TokenPurpose, token string, user *User) (bool, error)
- type ForgetPasswordTwoStepTokenPayload
- func (*ForgetPasswordTwoStepTokenPayload) Descriptor() ([]byte, []int)deprecated
- func (x *ForgetPasswordTwoStepTokenPayload) GetUserId() string
- func (*ForgetPasswordTwoStepTokenPayload) ProtoMessage()
- func (x *ForgetPasswordTwoStepTokenPayload) ProtoReflect() protoreflect.Message
- func (x *ForgetPasswordTwoStepTokenPayload) Reset()
- func (x *ForgetPasswordTwoStepTokenPayload) String() string
- func (m *ForgetPasswordTwoStepTokenPayload) Validate() error
- func (m *ForgetPasswordTwoStepTokenPayload) ValidateAll() error
- type ForgetPasswordTwoStepTokenPayloadMultiError
- type ForgetPasswordTwoStepTokenPayloadValidationError
- func (e ForgetPasswordTwoStepTokenPayloadValidationError) Cause() error
- func (e ForgetPasswordTwoStepTokenPayloadValidationError) Error() string
- func (e ForgetPasswordTwoStepTokenPayloadValidationError) ErrorName() string
- func (e ForgetPasswordTwoStepTokenPayloadValidationError) Field() string
- func (e ForgetPasswordTwoStepTokenPayloadValidationError) Key() bool
- func (e ForgetPasswordTwoStepTokenPayloadValidationError) Reason() string
- type LookupNormalizer
- type OtpTokenProvider
- type PasswordHasher
- type PasswordValidator
- type PasswordVerificationResult
- type PermissionSeeder
- type PhoneTokenProvider
- func (p *PhoneTokenProvider) CanGenerate(ctx context.Context, user *User) error
- func (p *PhoneTokenProvider) Generate(ctx context.Context, purpose TokenPurpose, user *User, duration time.Duration) (string, error)
- func (p *PhoneTokenProvider) Name() string
- func (p *PhoneTokenProvider) Validate(ctx context.Context, purpose TokenPurpose, token string, user *User) (bool, error)
- type RefreshToken
- type RefreshTokenRepo
- type Role
- type RoleManager
- func (r *RoleManager) Count(ctx context.Context, query *v12.ListRolesRequest) (total int64, filtered int64, err error)
- func (r *RoleManager) Create(ctx context.Context, role *Role) error
- func (r *RoleManager) Delete(ctx context.Context, id string) error
- func (r *RoleManager) FindByName(ctx context.Context, name string) (*Role, error)
- func (r *RoleManager) First(ctx context.Context, query *v12.ListRolesRequest) (*Role, error)
- func (r *RoleManager) Get(ctx context.Context, id string) (*Role, error)
- func (r *RoleManager) List(ctx context.Context, query *v12.ListRolesRequest) ([]*Role, error)
- func (r *RoleManager) Update(ctx context.Context, id string, role *Role, p query.Select) error
- type RoleRepo
- type RoleSeed
- type SignInManager
- func (s *SignInManager) CheckCanSignIn(ctx context.Context, u *User) error
- func (s *SignInManager) ExternalLoginSignInAsync(ctx context.Context, loginProvider, providerKey string, ...) error
- func (s *SignInManager) ForgetTwoFactorClient(ctx context.Context) error
- func (s *SignInManager) GetTwoFactorAuthenticationUser(ctx context.Context) (*User, error)
- func (s *SignInManager) IsSignedIn(ctx context.Context) (bool, error)
- func (s *SignInManager) IsTwoFactorClientRemembered(ctx context.Context, u *User) (bool, error)
- func (s *SignInManager) PasswordSignIn(ctx context.Context, u *User, pwd string, isPersistent bool, ...) error
- func (s *SignInManager) PasswordSignInWithEmail(ctx context.Context, email, pwd string, isPersistent bool, ...) (error, string)
- func (s *SignInManager) PasswordSignInWithPhone(ctx context.Context, phone, pwd string, isPersistent bool, ...) (error, string)
- func (s *SignInManager) PasswordSignInWithUsername(ctx context.Context, username, pwd string, isPersistent bool, ...) (error, string)
- func (s *SignInManager) RememberTwoFactorClient(ctx context.Context, u *User) error
- func (s *SignInManager) SignIn(ctx context.Context, u *User, isPersistent bool) error
- func (s *SignInManager) SignOut(ctx context.Context) error
- func (s *SignInManager) TwoFactorAuthenticatorSignIn(ctx context.Context, code string, isPersistent, rememberClient bool) error
- func (s *SignInManager) TwoFactorSignIn(ctx context.Context, provider, code string, isPersistent, rememberClient bool) error
- func (s *SignInManager) ValidateSecurityStamp(ctx context.Context, u *User, securityStamp string)
- type TokenPurpose
- type TwoStepTokenProvider
- type UpdateUserSetting
- type User
- type UserAddress
- type UserAddressRepo
- type UserLogin
- type UserManager
- func (um *UserManager) AddLogin(ctx context.Context, user *User, logins []UserLogin) error
- func (um *UserManager) AddToRole(ctx context.Context, user *User, role *Role) error
- func (um *UserManager) ChangePassword(ctx context.Context, user *User, current string, newPwd string) error
- func (um *UserManager) ChangePasswordByToken(ctx context.Context, token, newPwd string) error
- func (um *UserManager) CheckDeleted(ctx context.Context, u *User) (bool, error)
- func (um *UserManager) CheckLocked(ctx context.Context, u *User) (bool, error)
- func (um *UserManager) CheckPassword(ctx context.Context, user *User, password string) error
- func (um *UserManager) Count(ctx context.Context, query *v1.ListUsersRequest) (total int64, filtered int64, err error)
- func (um *UserManager) CountAdmin(ctx context.Context, query *v1.AdminListUsersRequest) (total int64, filtered int64, err error)
- func (um *UserManager) Create(ctx context.Context, u *User) (err error)
- func (um *UserManager) CreateWithPassword(ctx context.Context, u *User, pwd string, validate bool) (err error)
- func (um *UserManager) Delete(ctx context.Context, user *User) error
- func (um *UserManager) FindByEmail(ctx context.Context, email string) (user *User, err error)
- func (um *UserManager) FindByID(ctx context.Context, id string) (user *User, err error)
- func (um *UserManager) FindByIdentity(ctx context.Context, identity string) (user *User, err error)
- func (um *UserManager) FindByLogin(ctx context.Context, loginProvider string, providerKey string) (*User, error)
- func (um *UserManager) FindByName(ctx context.Context, name string) (user *User, err error)
- func (um *UserManager) FindByPhone(ctx context.Context, phone string) (user *User, err error)
- func (um *UserManager) GenerateEmailForgetPasswordToken(ctx context.Context, user *User) (string, error)
- func (um *UserManager) GenerateEmailLoginPasswordlessToken(ctx context.Context, email string) (string, error)
- func (um *UserManager) GenerateForgetPasswordTwoStepToken(ctx context.Context, user *User) (string, error)
- func (um *UserManager) GeneratePhoneForgetPasswordToken(ctx context.Context, user *User) (string, error)
- func (um *UserManager) GeneratePhoneLoginPasswordlessToken(ctx context.Context, phone string) (string, error)
- func (um *UserManager) GenerateRememberToken(ctx context.Context, duration time.Duration, uid uuid.UUID) (string, error)
- func (um *UserManager) GetRoles(ctx context.Context, userId string) ([]Role, error)
- func (um *UserManager) GetUserRoleIds(ctx context.Context, userId string, currentTenantOnly bool) ([]*UserRoleCacheItem_UserRole, error)
- func (um *UserManager) IsInTenant(ctx context.Context, uid, tenantId string) (bool, error)
- func (um *UserManager) JoinTenant(ctx context.Context, uid, tenantId string) error
- func (um *UserManager) List(ctx context.Context, query *v1.ListUsersRequest) ([]*User, error)
- func (um *UserManager) ListAdmin(ctx context.Context, query *v1.AdminListUsersRequest) ([]*User, error)
- func (um *UserManager) ListLogin(ctx context.Context, user *User) ([]*UserLogin, error)
- func (um *UserManager) RefreshRememberToken(ctx context.Context, token string, duration time.Duration) (*User, string, error)
- func (um *UserManager) RemoveFromRole(ctx context.Context, user *User, role *Role) error
- func (um *UserManager) RemoveFromTenant(ctx context.Context, uid, tenantId string) error
- func (um *UserManager) RemoveUserRoleCache(ctx context.Context, userId string) error
- func (um *UserManager) Update(ctx context.Context, user *User, q query.Select) (err error)
- func (um *UserManager) UpdatePassword(ctx context.Context, user *User, newPwd string) error
- func (um *UserManager) UpdateRoles(ctx context.Context, user *User, roles []Role) error
- func (um *UserManager) VerifyEmailForgetPasswordToken(ctx context.Context, email, token string) error
- func (um *UserManager) VerifyEmailLoginPasswordlessToken(ctx context.Context, email, token string) (*User, error)
- func (um *UserManager) VerifyPhoneForgetPasswordToken(ctx context.Context, phone, token string) error
- func (um *UserManager) VerifyPhoneLoginPasswordlessToken(ctx context.Context, phone, token string) (*User, error)
- type UserRepo
- type UserRole
- type UserRoleCacheItem
- func (*UserRoleCacheItem) Descriptor() ([]byte, []int)deprecated
- func (x *UserRoleCacheItem) GetRole() []*UserRoleCacheItem_UserRole
- func (*UserRoleCacheItem) ProtoMessage()
- func (x *UserRoleCacheItem) ProtoReflect() protoreflect.Message
- func (x *UserRoleCacheItem) Reset()
- func (x *UserRoleCacheItem) String() string
- func (m *UserRoleCacheItem) Validate() error
- func (m *UserRoleCacheItem) ValidateAll() error
- type UserRoleCacheItemMultiError
- type UserRoleCacheItemValidationError
- func (e UserRoleCacheItemValidationError) Cause() error
- func (e UserRoleCacheItemValidationError) Error() string
- func (e UserRoleCacheItemValidationError) ErrorName() string
- func (e UserRoleCacheItemValidationError) Field() string
- func (e UserRoleCacheItemValidationError) Key() bool
- func (e UserRoleCacheItemValidationError) Reason() string
- type UserRoleCacheItem_UserRole
- func (*UserRoleCacheItem_UserRole) Descriptor() ([]byte, []int)deprecated
- func (x *UserRoleCacheItem_UserRole) GetRoleId() string
- func (x *UserRoleCacheItem_UserRole) GetTenantId() string
- func (*UserRoleCacheItem_UserRole) ProtoMessage()
- func (x *UserRoleCacheItem_UserRole) ProtoReflect() protoreflect.Message
- func (x *UserRoleCacheItem_UserRole) Reset()
- func (x *UserRoleCacheItem_UserRole) String() string
- func (m *UserRoleCacheItem_UserRole) Validate() error
- func (m *UserRoleCacheItem_UserRole) ValidateAll() error
- type UserRoleCacheItem_UserRoleMultiError
- type UserRoleCacheItem_UserRoleValidationError
- func (e UserRoleCacheItem_UserRoleValidationError) Cause() error
- func (e UserRoleCacheItem_UserRoleValidationError) Error() string
- func (e UserRoleCacheItem_UserRoleValidationError) ErrorName() string
- func (e UserRoleCacheItem_UserRoleValidationError) Field() string
- func (e UserRoleCacheItem_UserRoleValidationError) Key() bool
- func (e UserRoleCacheItem_UserRoleValidationError) Reason() string
- type UserSeed
- type UserSetting
- type UserSettingRepo
- type UserTenant
- type UserTenantRepo
- type UserTenantStatus
- type UserToken
- type UserTokenProvider
- type UserTokenRepo
- type UserValidator
- type WeChatMiniProgramLoginTwoStepTokenPayload
- func (*WeChatMiniProgramLoginTwoStepTokenPayload) Descriptor() ([]byte, []int)deprecated
- func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetAppId() string
- func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetOpenId() string
- func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetSessionKey() string
- func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetStep() string
- func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetUnionId() string
- func (*WeChatMiniProgramLoginTwoStepTokenPayload) ProtoMessage()
- func (x *WeChatMiniProgramLoginTwoStepTokenPayload) ProtoReflect() protoreflect.Message
- func (x *WeChatMiniProgramLoginTwoStepTokenPayload) Reset()
- func (x *WeChatMiniProgramLoginTwoStepTokenPayload) String() string
- func (m *WeChatMiniProgramLoginTwoStepTokenPayload) Validate() error
- func (m *WeChatMiniProgramLoginTwoStepTokenPayload) ValidateAll() error
- type WeChatMiniProgramLoginTwoStepTokenPayloadMultiError
- type WeChatMiniProgramLoginTwoStepTokenPayloadValidationError
- func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Cause() error
- func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Error() string
- func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) ErrorName() string
- func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Field() string
- func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Key() bool
- func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Reason() string
Constants ¶
const ( Admin = "admin" AdminUsernameKey = "admin_username" AdminEmailKey = "admin_email" AdminPasswordKey = "admin_password" AdminUserId = "admin_user_id" )
const ( InternalLoginProvider string = "internal" InternalRememberTokenName string = "remember" )
const ( EmailName = "email" PhoneName = "phone" TwoStepName = "twostep" OtpName = "otp" EmailLoginPurpose = "login_email" PhoneLoginPurpose = "login_phone" ConfirmPurpose TokenPurpose = "confirm" RecoverPurpose TokenPurpose = "recover" RecoverChangePasswordPurpose TokenPurpose = "recover_change_password" )
const ConnName dal.ConnName = "user"
const UserAvatarPath = "user/avatar"
Variables ¶
var (
ErrWriterNotFound = errors.New("writer not found")
)
var File_user_private_biz_cache_proto protoreflect.FileDescriptor
var ProviderSet = kitdi.NewSet( NewUserManager, NewSignInManager, NewUserValidator, NewRoleManager, NewLookupNormalizer, kitdi.NewProvider(NewOtpTokenProvider, di.As(new(OtpTokenProvider))), NewEmailTokenProvider, NewPhoneTokenProvider, NewPasswordHasher, NewPasswordValidator, NewRoleSeed, NewUserSeed, NewPermissionSeeder, NewEmailSender, kitdi.NewProvider(NewUserRoleChangeEventHandler, di.As(new(event.ConsumerHandler))), )
ProviderSet is biz providers.
Functions ¶
func GenerateOtp ¶
func NewUserRoleChangeEventHandler ¶
func NewUserRoleChangeEventHandler(um *UserManager) event.ConsumerHandler
Types ¶
type DefaultEmailSender ¶
type DefaultEmailSender struct {
// contains filtered or unexported fields
}
DefaultEmailSender TODO template?
func (*DefaultEmailSender) SendForgetPassword ¶
func (d *DefaultEmailSender) SendForgetPassword(ctx context.Context, email, token string) error
func (*DefaultEmailSender) SendInviteTenant ¶
func (d *DefaultEmailSender) SendInviteTenant(ctx context.Context, email, token string) error
func (*DefaultEmailSender) SendPasswordlessLogin ¶
func (d *DefaultEmailSender) SendPasswordlessLogin(ctx context.Context, email, token string) error
type DefaultOtpTokenProvider ¶
type DefaultOtpTokenProvider struct {
// contains filtered or unexported fields
}
func NewOtpTokenProvider ¶
func NewOtpTokenProvider(c cache.CacheInterface[string]) *DefaultOtpTokenProvider
func (*DefaultOtpTokenProvider) GenerateOtp ¶
func (p *DefaultOtpTokenProvider) GenerateOtp(ctx context.Context, purpose TokenPurpose, extraKey string, duration time.Duration) (string, error)
func (*DefaultOtpTokenProvider) VerifyOtp ¶
func (p *DefaultOtpTokenProvider) VerifyOtp(ctx context.Context, purpose TokenPurpose, extraKey string, token string) (bool, error)
type EmailSender ¶
type EmailSender interface { //SendForgetPassword send forget password token SendForgetPassword(ctx context.Context, email, token string) error //SendInviteTenant send invite people into tenant SendInviteTenant(ctx context.Context, email, token string) error SendPasswordlessLogin(ctx context.Context, email, token string) error }
func NewEmailSender ¶
func NewEmailSender(emailer email.Client, cfg *kconf.Data) EmailSender
type EmailTokenProvider ¶
type EmailTokenProvider struct {
// contains filtered or unexported fields
}
func NewEmailTokenProvider ¶
func NewEmailTokenProvider(r cache.CacheInterface[string]) *EmailTokenProvider
func (*EmailTokenProvider) CanGenerate ¶
func (e *EmailTokenProvider) CanGenerate(ctx context.Context, user *User) error
func (*EmailTokenProvider) Generate ¶
func (e *EmailTokenProvider) Generate(ctx context.Context, purpose TokenPurpose, user *User, duration time.Duration) (string, error)
func (*EmailTokenProvider) Name ¶
func (e *EmailTokenProvider) Name() string
func (*EmailTokenProvider) Validate ¶
func (e *EmailTokenProvider) Validate(ctx context.Context, purpose TokenPurpose, token string, user *User) (bool, error)
type ForgetPasswordTwoStepTokenPayload ¶
type ForgetPasswordTwoStepTokenPayload struct { UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // contains filtered or unexported fields }
func (*ForgetPasswordTwoStepTokenPayload) Descriptor
deprecated
func (*ForgetPasswordTwoStepTokenPayload) Descriptor() ([]byte, []int)
Deprecated: Use ForgetPasswordTwoStepTokenPayload.ProtoReflect.Descriptor instead.
func (*ForgetPasswordTwoStepTokenPayload) GetUserId ¶
func (x *ForgetPasswordTwoStepTokenPayload) GetUserId() string
func (*ForgetPasswordTwoStepTokenPayload) ProtoMessage ¶
func (*ForgetPasswordTwoStepTokenPayload) ProtoMessage()
func (*ForgetPasswordTwoStepTokenPayload) ProtoReflect ¶
func (x *ForgetPasswordTwoStepTokenPayload) ProtoReflect() protoreflect.Message
func (*ForgetPasswordTwoStepTokenPayload) Reset ¶
func (x *ForgetPasswordTwoStepTokenPayload) Reset()
func (*ForgetPasswordTwoStepTokenPayload) String ¶
func (x *ForgetPasswordTwoStepTokenPayload) String() string
func (*ForgetPasswordTwoStepTokenPayload) Validate ¶
func (m *ForgetPasswordTwoStepTokenPayload) Validate() error
Validate checks the field values on ForgetPasswordTwoStepTokenPayload with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*ForgetPasswordTwoStepTokenPayload) ValidateAll ¶
func (m *ForgetPasswordTwoStepTokenPayload) ValidateAll() error
ValidateAll checks the field values on ForgetPasswordTwoStepTokenPayload with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ForgetPasswordTwoStepTokenPayloadMultiError, or nil if none found.
type ForgetPasswordTwoStepTokenPayloadMultiError ¶
type ForgetPasswordTwoStepTokenPayloadMultiError []error
ForgetPasswordTwoStepTokenPayloadMultiError is an error wrapping multiple validation errors returned by ForgetPasswordTwoStepTokenPayload.ValidateAll() if the designated constraints aren't met.
func (ForgetPasswordTwoStepTokenPayloadMultiError) AllErrors ¶
func (m ForgetPasswordTwoStepTokenPayloadMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ForgetPasswordTwoStepTokenPayloadMultiError) Error ¶
func (m ForgetPasswordTwoStepTokenPayloadMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ForgetPasswordTwoStepTokenPayloadValidationError ¶
type ForgetPasswordTwoStepTokenPayloadValidationError struct {
// contains filtered or unexported fields
}
ForgetPasswordTwoStepTokenPayloadValidationError is the validation error returned by ForgetPasswordTwoStepTokenPayload.Validate if the designated constraints aren't met.
func (ForgetPasswordTwoStepTokenPayloadValidationError) Cause ¶
func (e ForgetPasswordTwoStepTokenPayloadValidationError) Cause() error
Cause function returns cause value.
func (ForgetPasswordTwoStepTokenPayloadValidationError) Error ¶
func (e ForgetPasswordTwoStepTokenPayloadValidationError) Error() string
Error satisfies the builtin error interface
func (ForgetPasswordTwoStepTokenPayloadValidationError) ErrorName ¶
func (e ForgetPasswordTwoStepTokenPayloadValidationError) ErrorName() string
ErrorName returns error name.
func (ForgetPasswordTwoStepTokenPayloadValidationError) Field ¶
func (e ForgetPasswordTwoStepTokenPayloadValidationError) Field() string
Field function returns field value.
func (ForgetPasswordTwoStepTokenPayloadValidationError) Key ¶
func (e ForgetPasswordTwoStepTokenPayloadValidationError) Key() bool
Key function returns key value.
func (ForgetPasswordTwoStepTokenPayloadValidationError) Reason ¶
func (e ForgetPasswordTwoStepTokenPayloadValidationError) Reason() string
Reason function returns reason value.
type LookupNormalizer ¶
type LookupNormalizer interface { // Name normalizer Name(ctx context.Context, name string) (string, error) // Email normalizer Email(ctx context.Context, email string) (string, error) // Phone normalizer Phone(ctx context.Context, phone string) (string, error) }
func NewLookupNormalizer ¶
func NewLookupNormalizer(cfg *conf.AppConfig) LookupNormalizer
type OtpTokenProvider ¶
type PasswordHasher ¶
type PasswordHasher interface { HashPassword(ctx context.Context, user *User, password string) (hash string, err error) VerifyHashedPassword(ctx context.Context, user *User, hashedPassword string, providedPassword string) PasswordVerificationResult }
func NewPasswordHasher ¶
func NewPasswordHasher() PasswordHasher
type PasswordValidator ¶
type PasswordValidator interface { // Validate password Validate(ctx context.Context, password string) error }
func NewPasswordValidator ¶
func NewPasswordValidator(c *conf.UserConf) PasswordValidator
type PasswordVerificationResult ¶
type PasswordVerificationResult int32
const ( PasswordVerificationFail PasswordVerificationResult = iota PasswordVerificationSuccess PasswordVerificationSuccessRehashNeeded )
type PermissionSeeder ¶
type PermissionSeeder struct {
// contains filtered or unexported fields
}
func NewPermissionSeeder ¶
func NewPermissionSeeder(permission authz.PermissionManagementService, checker authz.PermissionChecker, rm *RoleManager) *PermissionSeeder
type PhoneTokenProvider ¶
type PhoneTokenProvider struct {
// contains filtered or unexported fields
}
func NewPhoneTokenProvider ¶
func NewPhoneTokenProvider(r cache.CacheInterface[string]) *PhoneTokenProvider
func (*PhoneTokenProvider) CanGenerate ¶
func (p *PhoneTokenProvider) CanGenerate(ctx context.Context, user *User) error
func (*PhoneTokenProvider) Generate ¶
func (p *PhoneTokenProvider) Generate(ctx context.Context, purpose TokenPurpose, user *User, duration time.Duration) (string, error)
func (*PhoneTokenProvider) Name ¶
func (p *PhoneTokenProvider) Name() string
func (*PhoneTokenProvider) Validate ¶
func (p *PhoneTokenProvider) Validate(ctx context.Context, purpose TokenPurpose, token string, user *User) (bool, error)
type RefreshToken ¶
type RefreshToken struct { Token string `gorm:"type:char(36);primaryKey"` UserId uuid.UUID `gorm:"type:char(36);index" json:"user_id"` Expires *time.Time Ip string UserAgent string Used bool }
func NewRefreshToken ¶
func (*RefreshToken) Valid ¶
func (r *RefreshToken) Valid() bool
type RefreshTokenRepo ¶
type Role ¶
type Role struct { kitgorm.UIDBase concurrency.HasVersion `gorm:"type:char(36)"` kitgorm.AuditedModel TenantId sgorm.HasTenant `gorm:"index:idx_tenant_role,unique"` Name string `json:"name" gorm:"size:200"` NormalizedName string `gorm:"size:200;index:idx_tenant_role,unique" json:"normalized_name" ` IsPreserved bool `json:"is_preserved"` }
type RoleManager ¶
type RoleManager struct {
// contains filtered or unexported fields
}
func NewRoleManager ¶
func NewRoleManager(repo RoleRepo, lookupNormalizer LookupNormalizer) *RoleManager
func (*RoleManager) Count ¶
func (r *RoleManager) Count(ctx context.Context, query *v12.ListRolesRequest) (total int64, filtered int64, err error)
func (*RoleManager) FindByName ¶
func (*RoleManager) First ¶
func (r *RoleManager) First(ctx context.Context, query *v12.ListRolesRequest) (*Role, error)
func (*RoleManager) List ¶
func (r *RoleManager) List(ctx context.Context, query *v12.ListRolesRequest) ([]*Role, error)
type RoleRepo ¶
type RoleRepo interface { data.Repo[Role, string, *v12.ListRolesRequest] FindByName(ctx context.Context, name string) (*Role, error) }
RoleRepo crud role
type RoleSeed ¶
type RoleSeed struct {
// contains filtered or unexported fields
}
func NewRoleSeed ¶
func NewRoleSeed(roleMgr *RoleManager, permission authz.PermissionManagementService) *RoleSeed
type SignInManager ¶
type SignInManager struct {
// contains filtered or unexported fields
}
func NewSignInManager ¶
func NewSignInManager(um *UserManager, securityCfg *conf.Security) *SignInManager
func (*SignInManager) CheckCanSignIn ¶
func (s *SignInManager) CheckCanSignIn(ctx context.Context, u *User) error
func (*SignInManager) ExternalLoginSignInAsync ¶
func (*SignInManager) ForgetTwoFactorClient ¶
func (s *SignInManager) ForgetTwoFactorClient(ctx context.Context) error
func (*SignInManager) GetTwoFactorAuthenticationUser ¶
func (s *SignInManager) GetTwoFactorAuthenticationUser(ctx context.Context) (*User, error)
func (*SignInManager) IsSignedIn ¶
func (s *SignInManager) IsSignedIn(ctx context.Context) (bool, error)
func (*SignInManager) IsTwoFactorClientRemembered ¶
func (*SignInManager) PasswordSignIn ¶
func (*SignInManager) PasswordSignInWithEmail ¶
func (*SignInManager) PasswordSignInWithPhone ¶
func (*SignInManager) PasswordSignInWithUsername ¶
func (*SignInManager) RememberTwoFactorClient ¶
func (s *SignInManager) RememberTwoFactorClient(ctx context.Context, u *User) error
func (*SignInManager) TwoFactorAuthenticatorSignIn ¶
func (*SignInManager) TwoFactorSignIn ¶
func (*SignInManager) ValidateSecurityStamp ¶
func (s *SignInManager) ValidateSecurityStamp(ctx context.Context, u *User, securityStamp string)
type TokenPurpose ¶
type TokenPurpose string
type TwoStepTokenProvider ¶
func NewTwoStepTokenProvider ¶
func NewTwoStepTokenProvider[T proto.Message](creator func() T, proxy cache.CacheInterface[string]) *TwoStepTokenProvider[T]
func (*TwoStepTokenProvider[T]) Generate ¶
func (p *TwoStepTokenProvider[T]) Generate(ctx context.Context, purpose TokenPurpose, payload T, duration time.Duration) (string, error)
func (*TwoStepTokenProvider[T]) Name ¶
func (p *TwoStepTokenProvider[T]) Name() string
func (*TwoStepTokenProvider[T]) Retrieve ¶
func (p *TwoStepTokenProvider[T]) Retrieve(ctx context.Context, purpose TokenPurpose, token string) (T, error)
type UpdateUserSetting ¶
type User ¶
type User struct { kitgorm.UIDBase `json:",squash"` concurrency.HasVersion `gorm:"type:char(36)"` kitgorm.AuditedModel kitgorm.AggRoot DeletedAt gorm.DeletedAt `gorm:"index"` Name *string `json:"name"` FirstName *string `json:"first_name"` LastName *string `json:"last_name"` Username *string `json:"username"` // NormalizedUsername uppercase normalized userName NormalizedUsername *string `json:"normalized_username" gorm:"index:,size:200"` // Phone Phone *string `json:"phone" gorm:"index:,size:200"` PhoneConfirmed bool `json:"phone_confirmed"` // Email Email *string `json:"email"` // NormalizedEmail uppercase normalized email NormalizedEmail *string `json:"normalized_email" gorm:"index:,size:200"` EmailConfirmed bool `json:"email_confirmed"` // Password hashed Password *string `json:"password"` //Security AccessFailedCount int `json:"accessFailedCount"` LastLoginAttempt *time.Time `json:"lastLoginAttempt"` LockoutEndDateUtc *time.Time `json:"lockoutEndDateUtc"` //2FA TwoFactorEnabled bool `json:"two_factor_enabled"` Roles []Role `gorm:"many2many:user_roles"` Location *string `json:"location"` Tags *string `json:"tags"` // Avatar could be an id of asset or simple url Avatar *string `json:"avatar"` Birthday *time.Time `json:"birthday"` Gender *string `json:"gender"` Tenants []UserTenant `json:"tenants"` Extra data.JSONMap //creation tenant CreatedTenant *string `json:"created_tenant"` }
type UserAddress ¶
type UserAddressRepo ¶
type UserAddressRepo interface { data.Repo[UserAddress, string, interface{}] FindByUser(ctx context.Context, userId string) ([]*UserAddress, error) SetPrefer(ctx context.Context, addr *UserAddress) error }
type UserManager ¶
type UserManager struct {
// contains filtered or unexported fields
}
func NewUserManager ¶
func NewUserManager( cfg *conf.UserConf, userRepo UserRepo, pwdHasher PasswordHasher, userValidator UserValidator, pwdValidator PasswordValidator, lookupNormalizer LookupNormalizer, userTokenRepo UserTokenRepo, refreshTokenRepo RefreshTokenRepo, userTenantRepo UserTenantRepo, emailToken *EmailTokenProvider, phoneToken *PhoneTokenProvider, otp OtpTokenProvider, strCache cache.CacheInterface[string], logger log.Logger) *UserManager
func (*UserManager) ChangePassword ¶
func (*UserManager) ChangePasswordByToken ¶
func (um *UserManager) ChangePasswordByToken(ctx context.Context, token, newPwd string) error
func (*UserManager) CheckDeleted ¶
func (*UserManager) CheckLocked ¶
func (*UserManager) CheckPassword ¶
func (*UserManager) Count ¶
func (um *UserManager) Count(ctx context.Context, query *v1.ListUsersRequest) (total int64, filtered int64, err error)
func (*UserManager) CountAdmin ¶
func (um *UserManager) CountAdmin(ctx context.Context, query *v1.AdminListUsersRequest) (total int64, filtered int64, err error)
func (*UserManager) Create ¶
func (um *UserManager) Create(ctx context.Context, u *User) (err error)
func (*UserManager) CreateWithPassword ¶
func (*UserManager) FindByEmail ¶
func (*UserManager) FindByIdentity ¶
func (*UserManager) FindByLogin ¶
func (*UserManager) FindByName ¶
func (*UserManager) FindByPhone ¶
func (*UserManager) GenerateEmailForgetPasswordToken ¶
func (*UserManager) GenerateEmailLoginPasswordlessToken ¶
func (*UserManager) GenerateForgetPasswordTwoStepToken ¶
func (*UserManager) GeneratePhoneForgetPasswordToken ¶
func (*UserManager) GeneratePhoneLoginPasswordlessToken ¶
func (*UserManager) GenerateRememberToken ¶
func (*UserManager) GetUserRoleIds ¶
func (um *UserManager) GetUserRoleIds(ctx context.Context, userId string, currentTenantOnly bool) ([]*UserRoleCacheItem_UserRole, error)
func (*UserManager) IsInTenant ¶
func (*UserManager) JoinTenant ¶
func (um *UserManager) JoinTenant(ctx context.Context, uid, tenantId string) error
JoinTenant add user into tenant. safe to call when user already in
func (*UserManager) List ¶
func (um *UserManager) List(ctx context.Context, query *v1.ListUsersRequest) ([]*User, error)
func (*UserManager) ListAdmin ¶
func (um *UserManager) ListAdmin(ctx context.Context, query *v1.AdminListUsersRequest) ([]*User, error)
func (*UserManager) RefreshRememberToken ¶
func (*UserManager) RemoveFromRole ¶
func (*UserManager) RemoveFromTenant ¶
func (um *UserManager) RemoveFromTenant(ctx context.Context, uid, tenantId string) error
func (*UserManager) RemoveUserRoleCache ¶
func (um *UserManager) RemoveUserRoleCache(ctx context.Context, userId string) error
func (*UserManager) UpdatePassword ¶
func (*UserManager) UpdateRoles ¶
func (*UserManager) VerifyEmailForgetPasswordToken ¶
func (um *UserManager) VerifyEmailForgetPasswordToken(ctx context.Context, email, token string) error
func (*UserManager) VerifyEmailLoginPasswordlessToken ¶
func (*UserManager) VerifyPhoneForgetPasswordToken ¶
func (um *UserManager) VerifyPhoneForgetPasswordToken(ctx context.Context, phone, token string) error
func (*UserManager) VerifyPhoneLoginPasswordlessToken ¶
type UserRepo ¶
type UserRepo interface { data.Repo[User, string, *v1.ListUsersRequest] ListAdmin(ctx context.Context, query *v1.AdminListUsersRequest) ([]*User, error) CountAdmin(ctx context.Context, query *v1.AdminListUsersRequest) (total int64, filtered int64, err error) FindByID(ctx context.Context, id string) (*User, error) FindByName(ctx context.Context, name string) (*User, error) FindByPhone(ctx context.Context, phone string) (*User, error) FindByEmail(ctx context.Context, email string) (*User, error) AddLogin(ctx context.Context, user *User, userLogin *UserLogin) error RemoveLogin(ctx context.Context, user *User, loginProvider string, providerKey string) error ListLogin(ctx context.Context, user *User) ([]*UserLogin, error) FindByLogin(ctx context.Context, loginProvider string, providerKey string) (*User, error) SetToken(ctx context.Context, user *User, loginProvider string, name string, value string) error RemoveToken(ctx context.Context, user *User, loginProvider string, name string) error GetToken(ctx context.Context, user *User, loginProvider string, name string) (*string, error) GetRoles(ctx context.Context, userId string) ([]Role, error) UpdateRoles(ctx context.Context, user *User, roles []Role) error AddToRole(ctx context.Context, user *User, role *Role) error RemoveFromRole(ctx context.Context, user *User, role *Role) error }
type UserRoleCacheItem ¶
type UserRoleCacheItem struct { Role []*UserRoleCacheItem_UserRole `protobuf:"bytes,1,rep,name=role,proto3" json:"role,omitempty"` // contains filtered or unexported fields }
func (*UserRoleCacheItem) Descriptor
deprecated
func (*UserRoleCacheItem) Descriptor() ([]byte, []int)
Deprecated: Use UserRoleCacheItem.ProtoReflect.Descriptor instead.
func (*UserRoleCacheItem) GetRole ¶
func (x *UserRoleCacheItem) GetRole() []*UserRoleCacheItem_UserRole
func (*UserRoleCacheItem) ProtoMessage ¶
func (*UserRoleCacheItem) ProtoMessage()
func (*UserRoleCacheItem) ProtoReflect ¶
func (x *UserRoleCacheItem) ProtoReflect() protoreflect.Message
func (*UserRoleCacheItem) Reset ¶
func (x *UserRoleCacheItem) Reset()
func (*UserRoleCacheItem) String ¶
func (x *UserRoleCacheItem) String() string
func (*UserRoleCacheItem) Validate ¶
func (m *UserRoleCacheItem) Validate() error
Validate checks the field values on UserRoleCacheItem with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*UserRoleCacheItem) ValidateAll ¶
func (m *UserRoleCacheItem) ValidateAll() error
ValidateAll checks the field values on UserRoleCacheItem with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UserRoleCacheItemMultiError, or nil if none found.
type UserRoleCacheItemMultiError ¶
type UserRoleCacheItemMultiError []error
UserRoleCacheItemMultiError is an error wrapping multiple validation errors returned by UserRoleCacheItem.ValidateAll() if the designated constraints aren't met.
func (UserRoleCacheItemMultiError) AllErrors ¶
func (m UserRoleCacheItemMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (UserRoleCacheItemMultiError) Error ¶
func (m UserRoleCacheItemMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type UserRoleCacheItemValidationError ¶
type UserRoleCacheItemValidationError struct {
// contains filtered or unexported fields
}
UserRoleCacheItemValidationError is the validation error returned by UserRoleCacheItem.Validate if the designated constraints aren't met.
func (UserRoleCacheItemValidationError) Cause ¶
func (e UserRoleCacheItemValidationError) Cause() error
Cause function returns cause value.
func (UserRoleCacheItemValidationError) Error ¶
func (e UserRoleCacheItemValidationError) Error() string
Error satisfies the builtin error interface
func (UserRoleCacheItemValidationError) ErrorName ¶
func (e UserRoleCacheItemValidationError) ErrorName() string
ErrorName returns error name.
func (UserRoleCacheItemValidationError) Field ¶
func (e UserRoleCacheItemValidationError) Field() string
Field function returns field value.
func (UserRoleCacheItemValidationError) Key ¶
func (e UserRoleCacheItemValidationError) Key() bool
Key function returns key value.
func (UserRoleCacheItemValidationError) Reason ¶
func (e UserRoleCacheItemValidationError) Reason() string
Reason function returns reason value.
type UserRoleCacheItem_UserRole ¶
type UserRoleCacheItem_UserRole struct { RoleId string `protobuf:"bytes,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` TenantId string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"` // contains filtered or unexported fields }
func (*UserRoleCacheItem_UserRole) Descriptor
deprecated
func (*UserRoleCacheItem_UserRole) Descriptor() ([]byte, []int)
Deprecated: Use UserRoleCacheItem_UserRole.ProtoReflect.Descriptor instead.
func (*UserRoleCacheItem_UserRole) GetRoleId ¶
func (x *UserRoleCacheItem_UserRole) GetRoleId() string
func (*UserRoleCacheItem_UserRole) GetTenantId ¶
func (x *UserRoleCacheItem_UserRole) GetTenantId() string
func (*UserRoleCacheItem_UserRole) ProtoMessage ¶
func (*UserRoleCacheItem_UserRole) ProtoMessage()
func (*UserRoleCacheItem_UserRole) ProtoReflect ¶
func (x *UserRoleCacheItem_UserRole) ProtoReflect() protoreflect.Message
func (*UserRoleCacheItem_UserRole) Reset ¶
func (x *UserRoleCacheItem_UserRole) Reset()
func (*UserRoleCacheItem_UserRole) String ¶
func (x *UserRoleCacheItem_UserRole) String() string
func (*UserRoleCacheItem_UserRole) Validate ¶
func (m *UserRoleCacheItem_UserRole) Validate() error
Validate checks the field values on UserRoleCacheItem_UserRole with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*UserRoleCacheItem_UserRole) ValidateAll ¶
func (m *UserRoleCacheItem_UserRole) ValidateAll() error
ValidateAll checks the field values on UserRoleCacheItem_UserRole with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UserRoleCacheItem_UserRoleMultiError, or nil if none found.
type UserRoleCacheItem_UserRoleMultiError ¶
type UserRoleCacheItem_UserRoleMultiError []error
UserRoleCacheItem_UserRoleMultiError is an error wrapping multiple validation errors returned by UserRoleCacheItem_UserRole.ValidateAll() if the designated constraints aren't met.
func (UserRoleCacheItem_UserRoleMultiError) AllErrors ¶
func (m UserRoleCacheItem_UserRoleMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (UserRoleCacheItem_UserRoleMultiError) Error ¶
func (m UserRoleCacheItem_UserRoleMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type UserRoleCacheItem_UserRoleValidationError ¶
type UserRoleCacheItem_UserRoleValidationError struct {
// contains filtered or unexported fields
}
UserRoleCacheItem_UserRoleValidationError is the validation error returned by UserRoleCacheItem_UserRole.Validate if the designated constraints aren't met.
func (UserRoleCacheItem_UserRoleValidationError) Cause ¶
func (e UserRoleCacheItem_UserRoleValidationError) Cause() error
Cause function returns cause value.
func (UserRoleCacheItem_UserRoleValidationError) Error ¶
func (e UserRoleCacheItem_UserRoleValidationError) Error() string
Error satisfies the builtin error interface
func (UserRoleCacheItem_UserRoleValidationError) ErrorName ¶
func (e UserRoleCacheItem_UserRoleValidationError) ErrorName() string
ErrorName returns error name.
func (UserRoleCacheItem_UserRoleValidationError) Field ¶
func (e UserRoleCacheItem_UserRoleValidationError) Field() string
Field function returns field value.
func (UserRoleCacheItem_UserRoleValidationError) Key ¶
func (e UserRoleCacheItem_UserRoleValidationError) Key() bool
Key function returns key value.
func (UserRoleCacheItem_UserRoleValidationError) Reason ¶
func (e UserRoleCacheItem_UserRoleValidationError) Reason() string
Reason function returns reason value.
type UserSeed ¶
type UserSeed struct {
// contains filtered or unexported fields
}
func NewUserSeed ¶
func NewUserSeed(um *UserManager, rm *RoleManager) *UserSeed
type UserSetting ¶
type UserSetting struct { gorm.UIDBase UserId string `json:"user_id" gorm:"index"` Key string `json:"key" gorm:"index"` Value data.Value `gorm:"embedded"` }
UserSetting contains key/value pairs of user settings
type UserSettingRepo ¶
type UserSettingRepo interface { data.Repo[UserSetting, string, *v1.GetSettingsRequest] FindByUser(ctx context.Context, userId string, query *v1.GetSettingsRequest) ([]*UserSetting, error) UpdateByUser(ctx context.Context, userId string, updateBatch []UpdateUserSetting) error }
type UserTenant ¶
type UserTenant struct { gorm2.AuditedModel UserId string `gorm:"type:char(36);primary_key" json:"user_id"` TenantId string `gorm:"type:char(36);primary_key" json:"tenant_id" ` JoinTime time.Time `json:"join_time"` Status UserTenantStatus `json:"status;index"` Extra data.JSONMap }
func (*UserTenant) GetTenantId ¶
func (u *UserTenant) GetTenantId() string
func (*UserTenant) SetTenantId ¶
func (u *UserTenant) SetTenantId(id string) *UserTenant
type UserTenantRepo ¶
type UserTenantRepo interface { JoinTenant(ctx context.Context, userId string, tenantId string, status UserTenantStatus) (*UserTenant, error) RemoveFromTenant(ctx context.Context, userId string, tenantId string) error Get(ctx context.Context, userId string, tenantId string) (*UserTenant, error) IsIn(ctx context.Context, userId string, tenantId string) (bool, error) Update(ctx context.Context, userTenant *UserTenant) error }
type UserTenantStatus ¶
type UserTenantStatus int32
const ( Active UserTenantStatus = 0 Inactive UserTenantStatus = 1 )
func (UserTenantStatus) String ¶
func (p UserTenantStatus) String() string
type UserToken ¶
type UserToken struct { gorm.AuditedModel DeletedAt gorm2.DeletedAt `gorm:"index"` UserId uuid.UUID `gorm:"type:char(36);primaryKey" json:"user_id"` LoginProvider string `gorm:"primaryKey" json:"login_provider"` Name string `gorm:"primaryKey" json:"name"` Value string `json:"value"` }
UserToken stores external login token
type UserTokenProvider ¶
type UserTokenProvider interface { // Name of this provider Name() string Generate(ctx context.Context, purpose TokenPurpose, user *User, duration time.Duration) (token string, err error) Validate(ctx context.Context, purpose TokenPurpose, token string, user *User) (bool, error) CanGenerate(ctx context.Context, user *User) error }
type UserTokenRepo ¶
type UserTokenRepo interface { FindByUserIdAndLoginProvider(ctx context.Context, userId, loginProvider string) ([]*UserToken, error) FindByUserIdAndLoginProviderAndName(ctx context.Context, userId, loginProvider, name string) (*UserToken, error) DeleteByUserIdAndLoginProvider(ctx context.Context, userId, loginProvider string) error DeleteByUserIdAndLoginProviderAndName(ctx context.Context, userId, loginProvider, name string) error Create(ctx context.Context, userId, loginProvider, name, value string) (*UserToken, error) }
type UserValidator ¶
type UserValidator interface {
Validate(ctx context.Context, um *UserManager, user *User) (err error)
}
UserValidator validate user before create and update
func NewUserValidator ¶
func NewUserValidator() UserValidator
type WeChatMiniProgramLoginTwoStepTokenPayload ¶
type WeChatMiniProgramLoginTwoStepTokenPayload struct { AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` SessionKey string `protobuf:"bytes,2,opt,name=session_key,json=sessionKey,proto3" json:"session_key,omitempty"` OpenId string `protobuf:"bytes,3,opt,name=open_id,json=openId,proto3" json:"open_id,omitempty"` UnionId string `protobuf:"bytes,4,opt,name=union_id,json=unionId,proto3" json:"union_id,omitempty"` Step string `protobuf:"bytes,5,opt,name=step,proto3" json:"step,omitempty"` // contains filtered or unexported fields }
func (*WeChatMiniProgramLoginTwoStepTokenPayload) Descriptor
deprecated
func (*WeChatMiniProgramLoginTwoStepTokenPayload) Descriptor() ([]byte, []int)
Deprecated: Use WeChatMiniProgramLoginTwoStepTokenPayload.ProtoReflect.Descriptor instead.
func (*WeChatMiniProgramLoginTwoStepTokenPayload) GetAppId ¶
func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetAppId() string
func (*WeChatMiniProgramLoginTwoStepTokenPayload) GetOpenId ¶
func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetOpenId() string
func (*WeChatMiniProgramLoginTwoStepTokenPayload) GetSessionKey ¶
func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetSessionKey() string
func (*WeChatMiniProgramLoginTwoStepTokenPayload) GetStep ¶
func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetStep() string
func (*WeChatMiniProgramLoginTwoStepTokenPayload) GetUnionId ¶
func (x *WeChatMiniProgramLoginTwoStepTokenPayload) GetUnionId() string
func (*WeChatMiniProgramLoginTwoStepTokenPayload) ProtoMessage ¶
func (*WeChatMiniProgramLoginTwoStepTokenPayload) ProtoMessage()
func (*WeChatMiniProgramLoginTwoStepTokenPayload) ProtoReflect ¶
func (x *WeChatMiniProgramLoginTwoStepTokenPayload) ProtoReflect() protoreflect.Message
func (*WeChatMiniProgramLoginTwoStepTokenPayload) Reset ¶
func (x *WeChatMiniProgramLoginTwoStepTokenPayload) Reset()
func (*WeChatMiniProgramLoginTwoStepTokenPayload) String ¶
func (x *WeChatMiniProgramLoginTwoStepTokenPayload) String() string
func (*WeChatMiniProgramLoginTwoStepTokenPayload) Validate ¶
func (m *WeChatMiniProgramLoginTwoStepTokenPayload) Validate() error
Validate checks the field values on WeChatMiniProgramLoginTwoStepTokenPayload with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*WeChatMiniProgramLoginTwoStepTokenPayload) ValidateAll ¶
func (m *WeChatMiniProgramLoginTwoStepTokenPayload) ValidateAll() error
ValidateAll checks the field values on WeChatMiniProgramLoginTwoStepTokenPayload with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in WeChatMiniProgramLoginTwoStepTokenPayloadMultiError, or nil if none found.
type WeChatMiniProgramLoginTwoStepTokenPayloadMultiError ¶
type WeChatMiniProgramLoginTwoStepTokenPayloadMultiError []error
WeChatMiniProgramLoginTwoStepTokenPayloadMultiError is an error wrapping multiple validation errors returned by WeChatMiniProgramLoginTwoStepTokenPayload.ValidateAll() if the designated constraints aren't met.
func (WeChatMiniProgramLoginTwoStepTokenPayloadMultiError) AllErrors ¶
func (m WeChatMiniProgramLoginTwoStepTokenPayloadMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (WeChatMiniProgramLoginTwoStepTokenPayloadMultiError) Error ¶
func (m WeChatMiniProgramLoginTwoStepTokenPayloadMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type WeChatMiniProgramLoginTwoStepTokenPayloadValidationError ¶
type WeChatMiniProgramLoginTwoStepTokenPayloadValidationError struct {
// contains filtered or unexported fields
}
WeChatMiniProgramLoginTwoStepTokenPayloadValidationError is the validation error returned by WeChatMiniProgramLoginTwoStepTokenPayload.Validate if the designated constraints aren't met.
func (WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Cause ¶
func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Cause() error
Cause function returns cause value.
func (WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Error ¶
func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Error() string
Error satisfies the builtin error interface
func (WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) ErrorName ¶
func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) ErrorName() string
ErrorName returns error name.
func (WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Field ¶
func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Field() string
Field function returns field value.
func (WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Key ¶
func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Key() bool
Key function returns key value.
func (WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Reason ¶
func (e WeChatMiniProgramLoginTwoStepTokenPayloadValidationError) Reason() string
Reason function returns reason value.
Source Files
¶
- biz.go
- cache.pb.go
- cache.pb.validate.go
- email_sender.go
- lookup_normalizer.go
- otp.go
- password_hasher.go
- password_validator.go
- permission_seeder.go
- refresh_token.go
- role.go
- role_seed.go
- signin.go
- user.go
- user_addr.go
- user_login.go
- user_manager.go
- user_role.go
- user_seed.go
- user_setting.go
- user_tenant.go
- user_token.go
- user_token_provider.go
- user_validator.go