woodglue.apps.uis¶
Serving the Console and UIs behind the view Grant.
Serving the Console and project UIs behind the view Grant.
Every UI has a name, and opening it needs view on ui:<name>; the Console is
the UI named console, served at /console/, and project UIs are served at
/ui/<name>/ (see woodglue.config.UiEntry). A page load without a Session
redirects to /auth/login?next=<path>, and one without the Grant gets 403. A
UI marked public skips both checks; the API it calls still needs a Caller.
The 403 is a bare message naming the missing Grant, unless a User signed in
with a Session has no Grants at all (e.g. just signed up with
default_roles: [], or pending): then it is a page saying who is signed in
and that the account is awaiting approval (if pending) or has no access yet,
with Sign out.
PAGE_STYLE = dedent('\n :root { color-scheme: light dark; --bg: #f6f6f4; --fg: #1d1d1b; --muted: #6b6b66;\n --card: #ffffff; --border: #dcdcd6; --accent: #b4632d; --error: #b3261e; }\n @media (prefers-color-scheme: dark) {\n :root { --bg: #141413; --fg: #ecece8; --muted: #9a9a93; --card: #1e1e1c;\n --border: #34342f; --accent: #e08a4f; --error: #f2b8b5; }\n }\n body { margin: 0; min-height: 100vh; display: grid; place-items: center;\n background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, sans-serif; }\n main { width: min(420px, calc(100vw - 32px)); background: var(--card);\n border: 1px solid var(--border); border-radius: 10px; padding: 28px; }\n h1 { font-size: 20px; margin: 0 0 4px; }\n p { color: var(--muted); margin: 0 0 20px; }\n label { display: block; font-size: 13px; margin-bottom: 6px; }\n input { box-sizing: border-box; width: 100%; padding: 10px 12px; font: 13px monospace;\n border: 1px solid var(--border); border-radius: 6px; background: var(--bg);\n color: var(--fg); }\n button { margin-top: 16px; width: 100%; padding: 10px; border: 0; border-radius: 6px;\n background: var(--accent); color: #fff; font: inherit; cursor: pointer; }\n .error { color: var(--error); margin: 0 0 16px; }\n .providers { display: grid; gap: 8px; margin-bottom: 20px; }\n .providers a { display: block; text-align: center; padding: 10px; border-radius: 6px;\n border: 1px solid var(--border); color: var(--fg); text-decoration: none; }\n .divider { text-align: center; color: var(--muted); font-size: 12px; margin: 4px 0 16px; }\n ').strip()
module-attribute
¶
CSS shared by woodglue's own pages: sign-in and no-Grants.
UiStaticHandler
¶
Bases: StaticFileHandler
Static files of one UI, gated by require_view unless public.
Source code in src/woodglue/apps/uis.py
VerifyHandler
¶
Bases: RequestHandler
GET /auth/verify: access check for a reverse proxy's forward_auth
(see docs/adr/0004). The UI is ?ui=<name>, or taken from the
X-Forwarded-Uri the proxy sends (/ui/<name>/... or /console/...).
Answers 200 with the identity headers for an allowed request, a redirect to
the login page (returning to the original URI) without a Session, 403
without the view Grant (the same page or message as require_view; the
proxy shows it to the browser), and 400 if no UI can be named.
Source code in src/woodglue/apps/uis.py
ui_path(name)
¶
The URL path where a UI is served.
identity_headers(auth, store, ui_name, grants=None)
¶
The headers that tell a UI's server who is viewing (see
woodglue.ui_support): the User as JSON, and for a browser Session a
Delegated Token for this UI, narrowed to the UI's grants.
Source code in src/woodglue/apps/uis.py
require_view(handler, ui_name)
¶
Check that the request may open ui_name, finishing it with a login
redirect or 403 if not. Returns the request's Authentication, or None
once the request is finished.