Documentation
¶
Overview ¶
Package oidc implements schemaf's built-in identity providers on top of a generic OIDC ID-token verifier (discovery + JWKS via coreos/go-oidc).
Built-ins are activated purely by environment variables (see FromEnv); apps don't import this package.
Index ¶
Constants ¶
const MaxTokenAge = 5 * time.Minute
MaxTokenAge is how old (by iat) an ID token may be when posted to the login route. The server can't check the nonce, so this limits replay.
Variables ¶
var Builtins = []Builtin{ { Name: "auth0", Title: "Auth0", DomainEnv: "PUBLIC_AUTH0_DOMAIN", ClientIDEnv: "PUBLIC_AUTH0_CLIENT_ID", Issuer: func(domain string) string { return "https://" + domain + "/" }, }, }
Builtins lists the built-in providers. Their names are reserved.
Functions ¶
func FromEnv ¶
func FromEnv(getenv func(string) string) ([]api.IdentityProvider, error)
FromEnv returns the built-in providers activated by the environment. For each built-in: neither variable set → off; both set → active; only one set → error.
func IsReserved ¶
IsReserved reports whether name belongs to a built-in provider.
Types ¶
type Builtin ¶
type Builtin struct {
Name string // reserved provider name, e.g. "auth0"
Title string // for messages, e.g. "Auth0"
DomainEnv string // e.g. "PUBLIC_AUTH0_DOMAIN"
ClientIDEnv string // e.g. "PUBLIC_AUTH0_CLIENT_ID"
Issuer func(domain string) string
}
Builtin describes a built-in identity provider activated by two env vars. Both are PUBLIC_* variables: the frontend needs the same values and reads them via /api/config. Further built-ins (keycloak, google, ...) are just more entries.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is an identity provider that accepts {"id_token": "<jwt>"} and verifies it against an OIDC issuer: signature via the issuer's JWKS, iss, aud (must contain the client ID), exp, and iat no older than MaxTokenAge.
func New ¶
New returns a provider named name for the given issuer URL and client ID. Discovery happens lazily on first login, so an unreachable issuer does not prevent the server from starting.