Documentation
¶
Overview ¶
Package auth is the auth client tier: it selects an organization/identity provider backend — Auth0 today (auth0/), an in-memory stub (stub/) for dev/test — by Kind and returns the interfaces.UserProvider contract (OrgProvider plus user provisioning), so switching auth providers is a config change, not a caller edit. The contract lives in core (interfaces.UserProvider + core/types); each backend implements it; this is the factory, which also wraps the provider in the fail-closed prod-guard decorator (CreateUser refused in production).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFromConfig ¶
func NewFromConfig(ctx context.Context, cfg Config) (interfaces.UserProvider, error)
NewFromConfig builds the auth provider selected by cfg.Kind: the Auth0 Management API client (KindAuth0) or the in-memory stub (KindStub). It is the app-wiring entrypoint mirroring the cache/storage NewFromConfig factory. Both backends satisfy interfaces.UserProvider (OrgProvider + user provisioning).
Types ¶
type Auth0Config ¶
type Auth0Config struct {
// Domain is the Auth0 tenant domain (e.g. "tenant.us.auth0.com").
Domain string
// ClientID is the M2M management API client id.
ClientID string
// ClientSecret is the M2M management API client secret (never logged).
ClientSecret string
// PlatformClientID is the Auth0 application id that org invitations grant access to.
PlatformClientID string
}
Auth0Config holds the Auth0 Management API settings for the auth0 backend, so callers configure the provider through the auth tier without touching the SDK.
type Config ¶
type Config struct {
// Auth0 holds the Auth0 Management API settings (used when Kind==KindAuth0).
Auth0 Auth0Config
// Env is the resolved deploy environment (SEARCH_ENV). It drives the fail-closed
// prod-guard decorator around CreateUser: only an allow-listed non-prod env (""/dev/
// staging/test/local) permits user provisioning; any other value is refused.
Env string
// Kind selects the backend. The zero value is KindAuth0.
Kind Kind
}
Config selects and configures the auth provider backend.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth0 is the Auth0 Management API backend of the clients/auth tier: it reads the tenant's organizations and an organization's members (iterating every page, skipping malformed records) and writes organizations (create/update/delete), every call behind a circuit breaker.
|
Package auth0 is the Auth0 Management API backend of the clients/auth tier: it reads the tenant's organizations and an organization's members (iterating every page, skipping malformed records) and writes organizations (create/update/delete), every call behind a circuit breaker. |
|
Package stub is the in-memory backend of the clients/auth tier: it satisfies interfaces.UserProvider (OrgProvider + user provisioning) with process-local state, so a service (or test) can run the organization/member, invitation, and user-provisioning flows without a real auth provider.
|
Package stub is the in-memory backend of the clients/auth tier: it satisfies interfaces.UserProvider (OrgProvider + user provisioning) with process-local state, so a service (or test) can run the organization/member, invitation, and user-provisioning flows without a real auth provider. |