Documentation ¶
Index ¶
- Variables
- type Checker
- type CheckerOptions
- type EmailChecker
- type EmailNormalizer
- type Normalizer
- type NormalizerFactory
- type NullChecker
- type NullNormalizer
- type PhoneChecker
- type PhoneNumberNormalizer
- type Provider
- func (p *Provider) Create(i *identity.LoginID) error
- func (p *Provider) Delete(i *identity.LoginID) error
- func (p *Provider) Get(userID, id string) (*identity.LoginID, error)
- func (p *Provider) GetByUniqueKey(uniqueKey string) (*identity.LoginID, error)
- func (p *Provider) GetByValue(value string) ([]*identity.LoginID, error)
- func (p *Provider) GetMany(ids []string) ([]*identity.LoginID, error)
- func (p *Provider) IsLoginIDKeyType(loginIDKey string, loginIDKeyType model.LoginIDKeyType) bool
- func (p *Provider) List(userID string) ([]*identity.LoginID, error)
- func (p *Provider) ListByClaim(name string, value string) ([]*identity.LoginID, error)
- func (p *Provider) New(userID string, spec identity.LoginIDSpec, options CheckerOptions) (*identity.LoginID, error)
- func (p *Provider) Normalize(typ model.LoginIDKeyType, value string) (normalized string, uniqueKey string, err error)
- func (p *Provider) Update(i *identity.LoginID) error
- func (p *Provider) ValidateOne(loginID identity.LoginIDSpec, options CheckerOptions) error
- func (p *Provider) WithValue(iden *identity.LoginID, value string, options CheckerOptions) (*identity.LoginID, error)
- type ResourceManager
- type Store
- func (s *Store) Create(i *identity.LoginID) (err error)
- func (s *Store) Delete(i *identity.LoginID) error
- func (s *Store) Get(userID, id string) (*identity.LoginID, error)
- func (s *Store) GetByLoginID(loginIDKey string, loginID string) (*identity.LoginID, error)
- func (s *Store) GetByUniqueKey(uniqueKey string) (*identity.LoginID, error)
- func (s *Store) GetMany(ids []string) ([]*identity.LoginID, error)
- func (s *Store) List(userID string) ([]*identity.LoginID, error)
- func (s *Store) ListByClaim(name string, value string) ([]*identity.LoginID, error)
- func (s *Store) Update(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) CheckType ¶
func (c *Checker) CheckType(loginIDKey string, t model.LoginIDKeyType) bool
func (*Checker) LoginIDKeyClaimName ¶
func (*Checker) ValidateOne ¶
func (c *Checker) ValidateOne(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 *validation.Context, loginID string)
type EmailNormalizer ¶
type EmailNormalizer struct {
Config *config.LoginIDEmailConfig
}
func (*EmailNormalizer) ComputeUniqueKey ¶
func (n *EmailNormalizer) ComputeUniqueKey(normalizeLoginID string) (string, error)
type Normalizer ¶
type NormalizerFactory ¶
type NormalizerFactory struct {
Config *config.LoginIDConfig
}
func (*NormalizerFactory) NormalizerWithLoginIDType ¶
func (f *NormalizerFactory) NormalizerWithLoginIDType(loginIDKeyType model.LoginIDKeyType) Normalizer
type NullChecker ¶
type NullChecker struct{}
func (*NullChecker) Validate ¶
func (c *NullChecker) Validate(ctx *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{}
func (*PhoneChecker) Validate ¶
func (c *PhoneChecker) Validate(ctx *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) GetByUniqueKey ¶
func (*Provider) GetByValue ¶
func (*Provider) IsLoginIDKeyType ¶
func (p *Provider) IsLoginIDKeyType(loginIDKey string, loginIDKeyType model.LoginIDKeyType) bool
func (*Provider) ListByClaim ¶
func (*Provider) New ¶
func (p *Provider) New(userID string, spec identity.LoginIDSpec, options CheckerOptions) (*identity.LoginID, error)
func (*Provider) ValidateOne ¶
func (p *Provider) ValidateOne(loginID identity.LoginIDSpec, options CheckerOptions) error
type ResourceManager ¶
type ResourceManager interface {
Read(desc resource.Descriptor, view resource.View) (interface{}, error)
}
type Store ¶
type Store struct { SQLBuilder *appdb.SQLBuilderApp SQLExecutor *appdb.SQLExecutor }
func (*Store) GetByLoginID ¶
func (*Store) GetByUniqueKey ¶
func (*Store) ListByClaim ¶
type TypeChecker ¶
type TypeChecker interface {
Validate(ctx *validation.Context, loginID string)
}
type TypeCheckerFactory ¶
type TypeCheckerFactory struct { Config *config.LoginIDConfig Resources ResourceManager }
func (*TypeCheckerFactory) NewChecker ¶
func (f *TypeCheckerFactory) NewChecker(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 *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.