AAI Portal internal auth infrastructure examined for wiki integration
Source type:
obs· Harvested: 2026-05-02 · Original date: 2026-05-01T19:44:54.917Z Metadata:{"project":"lunhsiangyuan","type":"discovery","obs_id":64820}
obs/64820 · discovery · 2026-05-01T19:44:54.917Z
AAI Portal internal auth infrastructure examined for wiki integration
Before implementing wiki integration, existing authentication infrastructure was examined to understand how to leverage it. The portal uses a clean three-tier access pattern: anonymous users see Google sign-in button, authenticated but unauthorized users see access request form, authorized users see filtered document cards based on their docs[] array. The whitelist system uses AAI_INTERNAL_ACCESS environment variable (same one used for separate wiki site) parsed by getAccessForEmail(), and requireInternalAccess() provides reusable server-side guard accepting doc slug parameter. This infrastructure is ready to protect wiki routes without modification - the guard function already supports per-document authorization which maps to per-wiki access control needed for the 4 wikis (tccp-wiki, cms-access, aacr2026, hnscc-wiki).
Concepts: [“how-it-works”,“pattern”]
Facts: [“Internal portal uses NextAuth v5 with Google OAuth provider, three-tier access control: unauthenticated (show sign-in), authenticated but not whitelisted (show request form), whitelisted (show filtered documents)”,“Whitelist stored in AAI_INTERNAL_ACCESS environment variable as JSON array with email, name, and docs[] fields”,“lib/internal-access.ts provides getAccessForEmail() function parsing whitelist and returning allowed doc slugs or null”,“lib/internal-guard.ts provides requireInternalAccess(docSlug) server function checking session and per-document permissions with redirect to /en/internal on failure”,“Internal routes have robots noindex/nofollow metadata, 4 existing files (2 API routes for tracking and access requests, 1 layout, 1 page)”,“2 internal components exist: document-card.tsx and request-access-form.tsx for portal UI”]
[← 回 Alfred Brain Hub]