enlace_auth#
enlace_auth — authentication, sessions, admin dashboard, and per-user stores.
Plug into enlace at compose time:
from enlace import build_backend, PlatformConfig
from enlace_auth import plugin as auth_plugin
config = PlatformConfig.from_toml()
app = build_backend(config, plugins=[auth_plugin])
When config.auth.enabled is True the plugin mounts:
/auth/*— login, logout, register, whoami, csrf, me/password, account (change your own), forgot-password / reset-password/_admin/api/*— admin user/app management (gated by admin allowlist)/api/{app}/store/*— per-user data storemiddleware: PlatformAuthMiddleware, CSRFMiddleware, StoreInjectionMiddleware
When it’s False the plugin is a no-op, so installing this package never changes platform behavior unless the operator opts in.
Functions
|
Mount /auth/, /_admin/, store routes, and middleware on |
|
Mount /auth/, /_admin/, store routes, and middleware on |
Classes
|
Platform-wide authentication configuration. |
|
Configuration for a single OAuth2/OIDC provider. |
|
Backend configuration for a MutableMapping-backed store. |
Exceptions
Raised when auth configuration is unusable at startup. |
- class enlace_auth.AuthConfig(*, enabled=False, session_cookie_name='enlace_session', session_max_age_seconds=86400, signing_key_env='ENLACE_SIGNING_KEY', secure_cookies=True, stores=<factory>, oauth=<factory>, oauth_server=<factory>, admin_emails=<factory>, admin_emails_env='ENLACE_ADMIN_EMAILS', registration_open=False, registration_allowlist_env='ENLACE_REGISTRATION_ALLOWLIST')[source]#
Bases:
_StrictModelPlatform-wide authentication configuration.
- exception enlace_auth.EnlaceAuthConfigError[source]#
Bases:
RuntimeErrorRaised when auth configuration is unusable at startup.
- class enlace_auth.OAuthProviderConfig(*, client_id_env, client_secret_env, scopes=<factory>, authorize_url=None, token_url=None, userinfo_url=None, server_metadata_url=None, trust_unverified_email=False)[source]#
Bases:
_StrictModelConfiguration for a single OAuth2/OIDC provider.
- class enlace_auth.StoreBackendConfig(*, backend='file', path='~/.enlace/platform_store')[source]#
Bases:
_StrictModelBackend configuration for a MutableMapping-backed store.
- enlace_auth.plugin(parent, config)#
Mount /auth/, /_admin/, store routes, and middleware on
parent.Plugin entry point. Safe to call when auth is disabled — does nothing.
- Return type:
- enlace_auth.wire(parent, config)[source]#
Mount /auth/, /_admin/, store routes, and middleware on
parent.Plugin entry point. Safe to call when auth is disabled — does nothing.
- Return type:
Modules
Admin subsystem for enlace_auth. |
|
Editable app-metadata overlay: the write surface for the launcher. |
|
Authentication subsystem for enlace. |
|
Auth-side configuration models. |
|
Auth-specific doctor checks that plug into |
|
One normal form for an email address, wherever one is compared. |
|
The OAuth per-connector allowlist: its shape, its parsing and its one rule. |
|
Per-user stores for enlace. |