sso

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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.

Jump to

Keyboard shortcuts

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