registry

package
v1.0.47 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocaUserRegistry

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

LocaUserRegistry is a local registry.

func (*LocaUserRegistry) AddRegistrationEntry

func (r *LocaUserRegistry) AddRegistrationEntry(s string, entry map[string]string) error

AddRegistrationEntry adds a registration entry.

func (*LocaUserRegistry) AddUser

func (r *LocaUserRegistry) AddUser(rr *requests.Request) error

AddUser adds user to the user registry.

func (*LocaUserRegistry) DeleteRegistrationEntry

func (r *LocaUserRegistry) DeleteRegistrationEntry(s string) error

DeleteRegistrationEntry deleted a registration entry by id.

func (*LocaUserRegistry) GetAdminEmails

func (r *LocaUserRegistry) GetAdminEmails() []string

GetAdminEmails returns admin email addresses.

func (*LocaUserRegistry) GetCode

func (r *LocaUserRegistry) GetCode() string

GetCode returns authorization code.

func (*LocaUserRegistry) GetConfig

func (r *LocaUserRegistry) GetConfig() map[string]interface{}

GetConfig returns user registry configuration.

func (*LocaUserRegistry) GetEmailProvider

func (r *LocaUserRegistry) GetEmailProvider() string

GetEmailProvider returns email provider name.

func (*LocaUserRegistry) GetIdentityStoreName

func (r *LocaUserRegistry) GetIdentityStoreName() string

GetIdentityStoreName returns associated identity store name.

func (*LocaUserRegistry) GetName

func (r *LocaUserRegistry) GetName() string

GetName returns the uid of the user registry.

func (*LocaUserRegistry) GetPasswordPolicyRegex

func (r *LocaUserRegistry) GetPasswordPolicyRegex() string

GetPasswordPolicyRegex returns password policy regular expression.

func (*LocaUserRegistry) GetPasswordPolicySummary

func (r *LocaUserRegistry) GetPasswordPolicySummary() string

GetPasswordPolicySummary returns password policy summary.

func (r *LocaUserRegistry) GetPrivacyPolicyLink() string

GetPrivacyPolicyLink returns the privacy policy link.

func (*LocaUserRegistry) GetRegistrationEntry

func (r *LocaUserRegistry) GetRegistrationEntry(s string) (map[string]string, error)

GetRegistrationEntry returns a registration entry by id.

func (*LocaUserRegistry) GetRequireAcceptTerms

func (r *LocaUserRegistry) GetRequireAcceptTerms() bool

GetRequireAcceptTerms returns true if the acceptance of terms is required.

func (*LocaUserRegistry) GetRequireDomainMailRecord

func (r *LocaUserRegistry) GetRequireDomainMailRecord() bool

GetRequireDomainMailRecord returns true if MX record requires validation.

func (r *LocaUserRegistry) GetTermsConditionsLink() string

GetTermsConditionsLink returns the terms and conditions link.

func (*LocaUserRegistry) GetTitle

func (r *LocaUserRegistry) GetTitle() string

GetTitle returns the title of signup page.

func (*LocaUserRegistry) GetUsernamePolicyRegex

func (r *LocaUserRegistry) GetUsernamePolicyRegex() string

GetUsernamePolicyRegex returns username policy regular expression.

func (*LocaUserRegistry) GetUsernamePolicySummary

func (r *LocaUserRegistry) GetUsernamePolicySummary() string

GetUsernamePolicySummary returns username policy summary.

func (*LocaUserRegistry) Notify

func (r *LocaUserRegistry) Notify(data map[string]string) error

Notify serves notifications.

type RegistrationCache

type RegistrationCache struct {
	Entries map[string]*RegistrationCacheEntry `json:"entries,omitempty" xml:"entries,omitempty" yaml:"entries,omitempty"`
	// contains filtered or unexported fields
}

RegistrationCache contains cached tokens

func NewRegistrationCache

func NewRegistrationCache() *RegistrationCache

NewRegistrationCache returns RegistrationCache instance.

func (*RegistrationCache) Add

func (c *RegistrationCache) Add(registrationID string, u map[string]string) error

Add adds user to the cache.

func (*RegistrationCache) Delete

func (c *RegistrationCache) Delete(registrationID string) error

Delete removes cached user entry.

func (*RegistrationCache) Expire

func (c *RegistrationCache) Expire(registrationID string)

Expire expires a particular registration entry.

func (*RegistrationCache) Get

func (c *RegistrationCache) Get(registrationID string) (map[string]string, error)

Get returns cached user entry.

func (*RegistrationCache) GetCleanupInterval

func (c *RegistrationCache) GetCleanupInterval() int

GetCleanupInterval returns cleanup interval.

func (*RegistrationCache) GetMaxEntryLifetime

func (c *RegistrationCache) GetMaxEntryLifetime() int

GetMaxEntryLifetime returns max entry lifetime.

func (*RegistrationCache) Run

func (c *RegistrationCache) Run()

Run starts management of RegistrationCache instance.

func (*RegistrationCache) SetCleanupInterval

func (c *RegistrationCache) SetCleanupInterval(i int) error

SetCleanupInterval sets cache management interval.

func (*RegistrationCache) SetMaxEntryLifetime

func (c *RegistrationCache) SetMaxEntryLifetime(i int) error

SetMaxEntryLifetime sets cache management max entry lifetime in seconds.

func (*RegistrationCache) Stop

func (c *RegistrationCache) Stop()

Stop stops management of RegistrationCache instance.

type RegistrationCacheEntry

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

RegistrationCacheEntry is an entry in RegistrationCache.

func (*RegistrationCacheEntry) Valid

func (e *RegistrationCacheEntry) Valid(max int) error

Valid checks whether RegistrationCacheEntry is non-expired.

type UserRegistry

type UserRegistry interface {
	// GetRealm() string
	GetName() string
	GetConfig() map[string]interface{}
	// Configure() error
	// Configured() bool
	AddUser(*requests.Request) error
	GetRegistrationEntry(string) (map[string]string, error)
	DeleteRegistrationEntry(string) error
	AddRegistrationEntry(string, map[string]string) error

	GetUsernamePolicyRegex() string
	GetUsernamePolicySummary() string
	GetPasswordPolicyRegex() string
	GetPasswordPolicySummary() string

	GetTitle() string
	GetCode() string
	GetRequireAcceptTerms() bool
	GetTermsConditionsLink() string
	GetPrivacyPolicyLink() string

	GetEmailProvider() string
	GetRequireDomainMailRecord() bool
	GetAdminEmails() []string

	Notify(map[string]string) error
	GetIdentityStoreName() string
}

UserRegistry represents user registry.

func NewUserRegistry

func NewUserRegistry(cfg *UserRegistryConfig, logger *zap.Logger) (UserRegistry, error)

NewUserRegistry returns UserRegistry instance.

type UserRegistryConfig

type UserRegistryConfig struct {
	Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"`
	// The switch determining whether the registration is enabled/disabled.
	Disabled bool `json:"disabled,omitempty" xml:"disabled,omitempty" yaml:"disabled,omitempty"`
	// The title of the registration page
	Title string `json:"title,omitempty" xml:"title,omitempty" yaml:"title,omitempty"`
	// The mandatory registration code. It is possible adding multiple
	// codes, comma separated.
	Code string `json:"code,omitempty" xml:"code,omitempty" yaml:"code,omitempty"`
	// The file path to registration database.
	Dropbox string `json:"dropbox,omitempty" xml:"dropbox,omitempty" yaml:"dropbox,omitempty"`
	// The switch determining whether a user must accept terms and conditions
	RequireAcceptTerms bool `json:"require_accept_terms,omitempty" xml:"require_accept_terms,omitempty" yaml:"require_accept_terms,omitempty"`
	// The switch determining whether the domain associated with an email has
	// a valid MX DNS record.
	RequireDomainMailRecord bool `json:"require_domain_mx,omitempty" xml:"require_domain_mx,omitempty" yaml:"require_domain_mx,omitempty"`
	// The link to terms and conditions document.
	TermsConditionsLink string `json:"terms_conditions_link,omitempty" xml:"terms_conditions_link,omitempty" yaml:"terms_conditions_link,omitempty"`
	// The link to privacy policy document.
	PrivacyPolicyLink string `json:"privacy_policy_link,omitempty" xml:"privacy_policy_link,omitempty" yaml:"privacy_policy_link,omitempty"`
	// The email provider used for the notifications.
	EmailProvider string `json:"email_provider,omitempty" xml:"email_provider,omitempty" yaml:"email_provider,omitempty"`
	// The email address(es) of portal administrators.
	AdminEmails []string `json:"admin_emails,omitempty" xml:"admin_emails,omitempty" yaml:"admin_emails,omitempty"`
	// The name of the identity store associated with the Config.
	IdentityStore string `json:"identity_store,omitempty" xml:"identity_store,omitempty" yaml:"identity_store,omitempty"`
	// contains filtered or unexported fields
}

UserRegistryConfig represents a common set of configuration settings for user registration

func (*UserRegistryConfig) SetCredentials

func (cfg *UserRegistryConfig) SetCredentials(c *credentials.Config)

SetCredentials binds to shared credentials.

func (*UserRegistryConfig) SetMessaging

func (cfg *UserRegistryConfig) SetMessaging(c *messaging.Config)

SetMessaging binds to messaging config.

func (*UserRegistryConfig) Validate

func (cfg *UserRegistryConfig) Validate() error

Validate validates user registration configuration.

func (*UserRegistryConfig) ValidateMessaging

func (cfg *UserRegistryConfig) ValidateMessaging() error

ValidateMessaging validates messaging provider and credentials used for the user registration.

Jump to

Keyboard shortcuts

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