Skip to content

Complete Auth Plugin

Complete Auth is an independent plugin repository. It is not part of Plystra Core.

Core intentionally keeps only minimal authentication: protected registration, password login, refresh/logout, and actor context. Use Complete Auth when an application needs hosted-auth-style flows such as public registration, email verification codes, and magic-link sign-in.

plystra/plugin-auth-complete

The plugin uses the same PostgreSQL database as Core, owns its plugin tables, and mints Core-compatible sessions after successful login or magic-link consumption. It does not create instance super-admin privileges through public registration.

MethodPathPurpose
POST/api/v1/auth/registerPublic registration when enabled in plugin_auth_settings.
POST/api/v1/auth/loginPassword login.
POST/api/v1/auth/refreshRefresh session tokens.
POST/api/v1/auth/logoutRevoke sessions.
POST/api/v1/auth/email-codeCreate and send a short-lived email verification-code challenge.
POST/api/v1/auth/email-code/verifyVerify a six-digit code and consume the challenge.
POST/api/v1/auth/magic-linkCreate and send a short-lived magic-link challenge.
POST/api/v1/auth/magic-link/consumeConsume a magic-link token and create a Core-compatible session.
GET/healthPlugin health check.

Only secrets and process bootstrap values come from environment variables. Non-sensitive, frequently changed runtime settings are stored in plugin_auth_settings.

SettingDefaultProduction guidance
public_registration_enabledfalseKeep disabled unless the application has a defined onboarding policy.
email_delivery_modelogUse capability in production.
email_capability_urlemptyHTTPS endpoint implementing POST /contract/v1/email/send.
email_capability_timeout10sKeep short and explicit.
email_from_addressemptyRequired in capability mode; must be a verified sender.
email_from_namePlystraNon-sensitive sender display name.
public_app_urlemptyUsed to build fallback magic-link URLs.
server_public_urlemptyUsed to build fallback server URLs.
magic_link_path/auth/consumeApplication consume path.
allowed_redirect_origins[]Additional HTTPS redirect origins.
email_code_ttl10mVerification-code challenge TTL.
magic_link_ttl10mMagic-link challenge TTL.
auth_challenge_max_attempts5Maximum verification attempts per challenge.
email_send_max_attempts3Challenge send attempts per rate-limit window.
login_failure_limit8Failed login attempts before lockout.
login_failure_window15mLogin failure counting window.
login_failure_lockout15mLockout duration.
max_request_body_bytes1048576JSON request body limit.
trusted_proxy_cidrs[]Reverse proxies allowed to provide forwarded client IP headers.

Do not store session secrets, email capability bearer tokens, SMTP passwords, or provider API credentials in this table.

VariableRequired whenPurpose
DATABASE_URL / PLYSTRA_DATABASE_URLAlwaysSame PostgreSQL database used by Core.
PLYSTRA_SESSION_SECRETAlwaysSame secret as Core so sessions are compatible.
PLYSTRA_SESSION_SECRET_PREVIOUSSecret rotationAccept old session tokens during rotation.
PLYSTRA_EMAIL_CAPABILITY_TOKEN / EMAIL_CAPABILITY_TOKENemail_delivery_mode=capabilityBearer token sent to the email capability provider.
AUTH_PLUGIN_LISTEN_ADDROptionalHTTP bind address.

Complete Auth pulls in the independent email contract only when email delivery is enabled:

plystra/email-contracts
capability id: email.transactional
version: 0.0.1
level: standard
endpoint: POST /contract/v1/email/send

Official provider implementations:

Provider repoRuntimeMutable settings
plystra/plugin-email-smtpNode/Nodemailer HTTP serviceNon-sensitive SMTP transport settings in plugin_email_smtp_settings; credentials in secrets/env.
plystra/plugin-email-cloudflareCloudflare WorkerCloudflare send_email binding and EMAIL_CAPABILITY_TOKEN secret; sender comes from the contract request.
  • Public registration is disabled by default.
  • Public registration creates normal active Users and default Simple Mode bindings in space_default; it does not create instance super-admin grants.
  • Codes and magic-link tokens are single-use and stored only as HMAC hashes.
  • Send and verification attempts are rate-limited.
  • Production must use email_delivery_mode=capability with an HTTPS capability URL.
  • Magic-link redirect URLs must be HTTPS and match public_app_url, server_public_url, or allowed_redirect_origins.
  • Provider credentials remain outside source-controlled config and outside non-sensitive settings tables.

Build from the parent Plystra workspace so the local email-contracts module replacement is available:

Terminal window
cd plystra
docker build -f plugin-auth-complete/Dockerfile -t plystra-auth-complete .

Apply plugin SQL migrations before starting the plugin. The plugin service should run after Core/PostgreSQL are ready and should expose /health for orchestration.