Security And Access
2-min readUpdated Oct 08, 2026
Vyasa security is route-aware rather than content-export oriented: the live app decides whether a request should pass, redirect to login, or stop with 403 before the page is rendered. The core checks are assembled in make_user_auth_before(), with config coming from VyasaConfig.get_oauth_providers() and VyasaConfig.get_rbac(). This guide is about how to think about auth in a live Vyasa site, not how to build a generic identity system. The important distinction is between "who may log in" and "which paths those people may read."
What You Can Turn On URL copied
auth_required = true
[google_oauth]
client_id = "REPLACE_ME"
client_secret = "REPLACE_ME"
allowed_domains = ["example.com"]
[microsoft_oauth]
client_id = "REPLACE_ME"
client_secret = "REPLACE_ME"
tenant_id = "00000000-0000-0000-0000-000000000000"
allowed_domains = ["example.com"]
[rbac]
enabled = true
default_roles = ["reader"]
Local username/password auth, Google, and Microsoft can coexist on the same login page; each provider in OAUTH_PROVIDERS adds one button. Every key also reads from VYASA_<PROVIDER>_<KEY>, for example VYASA_MICROSOFT_TENANT_ID. Each provider's default_roles applies only to accounts from that provider.
Microsoft needs a single-tenant app registration with the redirect URI https://<host>/auth/microsoft/callback. Vyasa refuses common, organizations, and consumers because a multi-tenant email claim is not verified, so any tenant could claim @example.com. With a GUID tenant_id, Vyasa also checks the token's tid claim in oauth_account_allowed(). RBAC then maps users to roles and roles to path patterns through resolve_roles() and is_allowed().
Why The Split Exists URL copied
| Concern | Why it is separate |
|---|---|
| login provider | Answers who may establish an identity at all. |
| role resolution | Turns identity into stable capabilities. |
| path rules | Lets one site host public and restricted branches together. |
| drawing passwords | Protects individual Excalidraw assets without inventing full RBAC for every sketch. |