Documentation
¶
Overview ¶
Package sso selects the federated login provider for a user's input: an exact provider name or an e-mail address whose domain is registered.
Names and domains are trimmed and lower-cased. Registration fails on duplicates, so one input can never resolve to two providers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registration ¶
type Registration struct {
Provider authentication.FederatedProvider
Domains []string
}
Registration registers a provider and the e-mail domains it serves.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps provider names and e-mail domains to providers. It is immutable after construction and safe for concurrent use.
func NewRegistry ¶
func NewRegistry(registrations []Registration) (*Registry, error)
NewRegistry validates registrations and returns a Registry. It returns authentication.ErrInvalidCredential for nil providers, invalid names or domains, and duplicates.
func (*Registry) Select ¶
func (r *Registry) Select(input string) (authentication.FederatedProvider, error)
Select returns the provider registered under input as a name or, for an address of the form "local@domain", under its domain. It returns authentication.ErrProviderNotFound otherwise.