Documentation
¶
Index ¶
- Variables
- type Checker
- type CheckerOptions
- type EmailChecker
- type EmailNormalizer
- type NormalizerFactory
- type NullChecker
- type NullNormalizer
- type PhoneChecker
- type PhoneNumberNormalizer
- type Provider
- func (p *Provider) CheckAndNormalize(ctx context.Context, spec identity.LoginIDSpec) (normalized string, uniqueKey string, err error)
- func (p *Provider) Create(ctx context.Context, i *identity.LoginID) error
- func (p *Provider) Delete(ctx context.Context, i *identity.LoginID) error
- func (p *Provider) Get(ctx context.Context, userID, id string) (*identity.LoginID, error)
- func (p *Provider) GetByKeyAndValue(ctx context.Context, key string, value string) (*identity.LoginID, error)
- func (p *Provider) GetByUniqueKey(ctx context.Context, uniqueKey string) (*identity.LoginID, error)
- func (p *Provider) GetByValue(ctx context.Context, value string) ([]*identity.LoginID, error)
- func (p *Provider) GetMany(ctx context.Context, ids []string) ([]*identity.LoginID, error)
- func (p *Provider) List(ctx context.Context, userID string) ([]*identity.LoginID, error)
- func (p *Provider) ListByClaim(ctx context.Context, name string, value string) ([]*identity.LoginID, error)
- func (p *Provider) New(ctx context.Context, userID string, spec identity.LoginIDSpec, ...) (*identity.LoginID, error)
- func (p *Provider) Normalize(typ model.LoginIDKeyType, value string) (normalized string, uniqueKey string, err error)
- func (p *Provider) Update(ctx context.Context, i *identity.LoginID) error
- func (p *Provider) WithValue(ctx context.Context, iden *identity.LoginID, value string, ...) (*identity.LoginID, error)
- type ResourceManager
- type Store
- func (s *Store) Create(ctx context.Context, i *identity.LoginID) (err error)
- func (s *Store) Delete(ctx context.Context, i *identity.LoginID) error
- func (s *Store) Get(ctx context.Context, userID, id string) (*identity.LoginID, error)
- func (s *Store) GetByUniqueKey(ctx context.Context, uniqueKey string) (*identity.LoginID, error)
- func (s *Store) GetMany(ctx context.Context, ids []string) ([]*identity.LoginID, error)
- func (s *Store) List(ctx context.Context, userID string) ([]*identity.LoginID, error)
- func (s *Store) ListByClaim(ctx context.Context, name string, value string) ([]*identity.LoginID, error)
- func (s *Store) Update(ctx context.Context, i *identity.LoginID) error
- type TypeChecker
- type TypeCheckerFactory
- type UsernameChecker
- type UsernameNormalizer
Constants ¶
This section is empty.
Variables ¶
View Source
var DependencySet = wire.NewSet( wire.Struct(new(TypeCheckerFactory), "*"), wire.Struct(new(Checker), "*"), wire.Struct(new(NormalizerFactory), "*"), wire.Struct(new(Store), "*"), wire.Struct(new(Provider), "*"), )
View Source
var EmailDomainAllowListTXT = resource.RegisterResource(resource.NewlineJoinedDescriptor{ Path: "email_domain_allowlist.txt", Parse: func(data []byte) (interface{}, error) { return matchlist.New(string(data), true, false) }, })
View Source
var EmailDomainBlockListTXT = resource.RegisterResource(resource.NewlineJoinedDescriptor{ Path: "email_domain_blocklist.txt", Parse: func(data []byte) (interface{}, error) { return matchlist.New(string(data), true, false) }, })
View Source
var FreeEmailProviderDomainsTXT = resource.RegisterResource(resource.NewlineJoinedDescriptor{ Path: "free_email_provider_domain_list.txt", Parse: func(data []byte) (interface{}, error) { return matchlist.New(string(data), true, false) }, })
FreeEmailProviderDomainsTXT is provided by https://gist.github.com/tbrianjones/5992856/93213efb652749e226e69884d6c048e595c1280a
View Source
var ReservedNameTXT = resource.RegisterResource(resource.NewlineJoinedDescriptor{ Path: "reserved_name.txt", Parse: func(data []byte) (interface{}, error) { return blocklist.New(string(data)) }, })
View Source
var UsernameExcludedKeywordsTXT = resource.RegisterResource(resource.NewlineJoinedDescriptor{ Path: "username_excluded_keywords.txt", Parse: func(data []byte) (interface{}, error) { return matchlist.New(string(data), true, true) }, })
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct { Config *config.LoginIDConfig TypeCheckerFactory *TypeCheckerFactory }
func (*Checker) ValidateOne ¶
func (c *Checker) ValidateOne(ctx context.Context, loginID identity.LoginIDSpec, options CheckerOptions) error
type CheckerOptions ¶
type CheckerOptions struct {
EmailByPassBlocklistAllowlist bool
}
type EmailChecker ¶
type EmailChecker struct { Config *config.LoginIDEmailConfig // DomainBlockList, DomainAllowList and BlockFreeEmailProviderDomains // are provided by TypeCheckerFactory based on config, so the related // resources will only be loaded when it is enabled // EmailChecker will not further check the config before performing // validation DomainBlockList *matchlist.MatchList DomainAllowList *matchlist.MatchList BlockFreeEmailProviderDomains *matchlist.MatchList Error error }
func (*EmailChecker) Validate ¶
func (c *EmailChecker) Validate(ctx context.Context, validationCtx *validation.Context, loginID string)
type EmailNormalizer ¶
type EmailNormalizer struct {
Config *config.LoginIDEmailConfig
}
func (*EmailNormalizer) ComputeUniqueKey ¶
func (n *EmailNormalizer) ComputeUniqueKey(normalizeLoginID string) (string, error)
type NormalizerFactory ¶
type NormalizerFactory struct {
Config *config.LoginIDConfig
}
func (*NormalizerFactory) NormalizerWithLoginIDType ¶
func (f *NormalizerFactory) NormalizerWithLoginIDType(loginIDKeyType model.LoginIDKeyType) internalinterface.LoginIDNormalizer
type NullChecker ¶
type NullChecker struct{}
func (*NullChecker) Validate ¶
func (c *NullChecker) Validate(ctx context.Context, valicationCtx *validation.Context, loginID string)
type NullNormalizer ¶
type NullNormalizer struct{}
func (*NullNormalizer) ComputeUniqueKey ¶
func (n *NullNormalizer) ComputeUniqueKey(normalizeLoginID string) (string, error)
type PhoneChecker ¶
type PhoneChecker struct {
Alpha2AllowList []string
}
func (*PhoneChecker) Validate ¶
func (c *PhoneChecker) Validate(ctx context.Context, validationCtx *validation.Context, loginID string)
type PhoneNumberNormalizer ¶
type PhoneNumberNormalizer struct { }
func (*PhoneNumberNormalizer) ComputeUniqueKey ¶
func (n *PhoneNumberNormalizer) ComputeUniqueKey(normalizeLoginID string) (string, error)
type Provider ¶
type Provider struct { Store *Store Config *config.LoginIDConfig Checker *Checker NormalizerFactory *NormalizerFactory Clock clock.Clock }
func (*Provider) CheckAndNormalize ¶
func (*Provider) GetByKeyAndValue ¶
func (*Provider) GetByUniqueKey ¶
func (*Provider) GetByValue ¶
func (*Provider) ListByClaim ¶
func (*Provider) New ¶
func (p *Provider) New(ctx context.Context, userID string, spec identity.LoginIDSpec, options CheckerOptions) (*identity.LoginID, error)
type ResourceManager ¶
type Store ¶
type Store struct { SQLBuilder *appdb.SQLBuilderApp SQLExecutor *appdb.SQLExecutor }
func (*Store) GetByUniqueKey ¶
func (*Store) ListByClaim ¶
type TypeChecker ¶
type TypeChecker interface {
Validate(ctx context.Context, validationCtx *validation.Context, loginID string)
}
type TypeCheckerFactory ¶
type TypeCheckerFactory struct { UIConfig *config.UIConfig LoginIDConfig *config.LoginIDConfig Resources ResourceManager }
func (*TypeCheckerFactory) NewChecker ¶
func (f *TypeCheckerFactory) NewChecker(ctx context.Context, loginIDKeyType model.LoginIDKeyType, options CheckerOptions) TypeChecker
type UsernameChecker ¶
type UsernameChecker struct { Config *config.LoginIDUsernameConfig // ReservedNames and ExcludedKeywords // are provided by TypeCheckerFactory based on config, so the related // resources will only be loaded when it is enabled // UsernameChecker will not further check the config before performing // validation ReservedNames *blocklist.Blocklist ExcludedKeywords *matchlist.MatchList Error error }
func (*UsernameChecker) Validate ¶
func (c *UsernameChecker) Validate(ctx context.Context, validationCtx *validation.Context, loginID string)
type UsernameNormalizer ¶
type UsernameNormalizer struct {
Config *config.LoginIDUsernameConfig
}
func (*UsernameNormalizer) ComputeUniqueKey ¶
func (n *UsernameNormalizer) ComputeUniqueKey(normalizeLoginID string) (string, error)
Click to show internal directories.
Click to hide internal directories.