Documentation
¶
Overview ¶
Package social implements sign-in for individual accounts through the deployment's OpenID provider (linked via identities; no password), on the relying party in internal/auth/oidc. It admits anyone with an account at the provider, grants an individual session and is configured server-wide.
Index ¶
Constants ¶
View Source
const ( // ProviderAuthentik is the deployment's generic sign-in provider under // the id authentik, where its accounts are linked under that id: the // same provider as ProviderOIDC, with no defaults. ProviderAuthentik = "authentik" // ProviderOIDC is the deployment's generic sign-in provider: any OpenID // Connect issuer the operator points it at, with no defaults. ProviderOIDC = "oidc" )
Provider ids. Closed set: an unknown id is a 404, never a guess.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
ClientID string
ClientSecret string
// Issuer is the OpenID provider's issuer; its discovery document names
// every endpoint.
Issuer string
Scopes []string
// HTTPClient is used for discovery, token exchange, and API calls.
HTTPClient *http.Client
}
Config configures the provider.
type Identity ¶
type Identity struct {
// Provider is the provider id ("oidc", "authentik").
Provider string
// Subject is the provider's stable id for this account, NOT namespaced.
Subject string
// NamespacedSubject is what goes in identities.subject: "<provider>:<sub>".
// Namespacing keeps one provider's subject 42 apart from another's in a
// single-column, provider-agnostic identity table.
NamespacedSubject string
Email string
EmailVerified bool
DisplayName string
// AMR/ACR carry the ID token's authentication-method claims. See
// oidc.Claims.
AMR []string
ACR string
// Groups is the ID token's `groups` claim (directory group names).
Groups []string
// Username is the ID token's `preferred_username`: the name chosen at the
// IdP, which seeds a new account's handle. Never used to find an account.
Username string
// AuthTime is the ID token's `auth_time`: when the person last actually
// authenticated at the IdP (zero when absent). A remembered browser is
// minted only from a fresh one.
AuthTime time.Time
// Claims is every claim of the ID token, for a reader of an IdP's own
// claims: an extension reads them through the sign-in hook.
Claims map[string]any
}
Identity is what a completed sign-in asserts about the caller.
func (*Identity) MFAAsserted ¶
MFAAsserted reports whether AMR names a second factor, by the relying party's rule (oidcrp.AMRNamesSecondFactor).
type Provider ¶
type Provider interface {
// Name is the provider id.
Name() string
// UsesPKCE reports whether Exchange expects a PKCE verifier.
UsesPKCE() bool
// AuthURL builds the provider's authorization URL.
AuthURL(state, nonce, verifier string) string
// Exchange completes the flow and returns the asserted identity.
Exchange(ctx context.Context, code, verifier, nonce string) (*Identity, error)
}
Provider is the configured sign-in provider.
Click to show internal directories.
Click to hide internal directories.