Authentication Portal Themes
Create a deployable theme in the consuming application's theme directory, with
the user's branding, working portal flows, and matching configuration. Start
from the built-in templates for the AuthCrunch version the application runs.
Use an existing custom theme as a design reference, then carry its styling onto
those templates. Filesystem overrides do not inherit later upstream changes.
Choose the Customization Surface
- For colors, typography, spacing, and a logo, prefer UI parameters and custom
CSS. Keep the built-in markup when it meets the request.
- For a branded page shell, favicon/metadata, or different layout, copy and
override the affected templates. Unspecified aliases keep their built-in
templates. A complete theme should account for every page the application
exposes, including session continuation and logout confirmation when enabled.
- Keep application themes in the consuming application. Editing
pkg/authn/ui/page_templates/basic changes the library's default UI and is
appropriate only when that is the requested scope.
The React profile app under pkg/authn/ui/profile is a separate asset surface;
portal template overrides do not rebuild or restyle it automatically.
Build the Theme
- Inspect the application's AuthCrunch version, current UI configuration,
portal mount, theme directory, brand assets, and exposed flows. Infer visual
choices from supplied references; ask only for missing choices that affect
the result. Do not assume a particular company, realm, hostname, or palette.
- Read configuration.md when selecting overrides,
wiring files, or debugging asset URLs. The registered theme remains
basic;
a custom folder name is not a new value for ui.theme.
- Before changing markup, read
template-contracts.md and inspect the
corresponding current template, handler, and scripts. Keep authentication
forms, conditional views, navigation, translations, and script hooks intact.
- Use brand-assets-and-color.md for
suggested logo/banner/background sizes, formats, composition, and color
palettes. Use design-and-validation.md
for page layout, CSS ordering, and validation. Produce shared styles plus
page-specific adjustments instead of forcing a narrow login card onto
registration forms or identity/SSO tables.
- Deliver the templates/assets and the exact UI configuration needed to load
them. Report which aliases changed, which use defaults, the required runtime
paths, and which rendering/browser checks ran.
Compatibility Essentials
Use Go html/template, not a frontend component language. Each custom file is
parsed independently; shared template partials require preprocessing into each
file. The repository supplies pathjoin and brsplitline, not Sprig or an
include function. Preserve contextual escaping.
Build local navigation and asset paths from .ActionEndpoint, which is the
portal mount, not the login URL. Keep .LogoURL and .LogoDescription useful
when the theme is meant to accept configuration. Do not embed credentials,
application-specific redirect scripts, or hardcoded user/role lists in a theme.
Preserve the current portal refresh script and the session template's DOM and
script attributes. The session response blocks inline CSS/JavaScript: load
theme CSS from the same origin. Do not relax its Content Security Policy to
reuse an inline style block. Read refresh-token-transports if changing session
behavior; visual changes alone do not require redesigning the refresh flow.
Source of Truth
Paths below are relative to the repository root:
pkg/authn/ui/params.go: UI configuration fields.
pkg/authn/portal.go, configureUserInterface: default and override loading.
pkg/authn/ui/ui.go: template functions, Args, BaseURL, and rendering.
pkg/authn/ui/page_templates/basic/: current template baselines.
pkg/authn/ui/core/css/ and pkg/authn/ui/core/js/: styles and DOM consumers.
pkg/authn/handle_http_static.go: public asset routing and caching.
pkg/authn/handle_http_session.go: session rendering and response policy.
Use the application's pinned dependency when it differs from this checkout.
Recompare overrides with that baseline on upgrades; do not copy an older theme's
functional omissions into a new theme.
1---2name: authentication-portal-themes3description: Build, customize, or update AuthCrunch authentication portal themes using Go HTML templates, CSS, logos, favicons, banners, and backgrounds. Use for filesystem template overrides and their UI/static-asset configuration; the embedded React profile application has a separate build.4---56# Authentication Portal Themes78Create a deployable theme in the consuming application's theme directory, with9the user's branding, working portal flows, and matching configuration. Start10from the built-in templates for the AuthCrunch version the application runs.11Use an existing custom theme as a design reference, then carry its styling onto12those templates. Filesystem overrides do not inherit later upstream changes.1314## Choose the Customization Surface1516- For colors, typography, spacing, and a logo, prefer UI parameters and custom17 CSS. Keep the built-in markup when it meets the request.18- For a branded page shell, favicon/metadata, or different layout, copy and19 override the affected templates. Unspecified aliases keep their built-in20 templates. A complete theme should account for every page the application21 exposes, including session continuation and logout confirmation when enabled.22- Keep application themes in the consuming application. Editing23 `pkg/authn/ui/page_templates/basic` changes the library's default UI and is24 appropriate only when that is the requested scope.2526The React profile app under `pkg/authn/ui/profile` is a separate asset surface;27portal template overrides do not rebuild or restyle it automatically.2829## Build the Theme30311. Inspect the application's AuthCrunch version, current UI configuration,32 portal mount, theme directory, brand assets, and exposed flows. Infer visual33 choices from supplied references; ask only for missing choices that affect34 the result. Do not assume a particular company, realm, hostname, or palette.352. Read [configuration.md](references/configuration.md) when selecting overrides,36 wiring files, or debugging asset URLs. The registered theme remains `basic`;37 a custom folder name is not a new value for `ui.theme`.383. Before changing markup, read39 [template-contracts.md](references/template-contracts.md) and inspect the40 corresponding current template, handler, and scripts. Keep authentication41 forms, conditional views, navigation, translations, and script hooks intact.424. Use [brand-assets-and-color.md](references/brand-assets-and-color.md) for43 suggested logo/banner/background sizes, formats, composition, and color44 palettes. Use [design-and-validation.md](references/design-and-validation.md)45 for page layout, CSS ordering, and validation. Produce shared styles plus46 page-specific adjustments instead of forcing a narrow login card onto47 registration forms or identity/SSO tables.485. Deliver the templates/assets and the exact UI configuration needed to load49 them. Report which aliases changed, which use defaults, the required runtime50 paths, and which rendering/browser checks ran.5152## Compatibility Essentials5354Use Go `html/template`, not a frontend component language. Each custom file is55parsed independently; shared template partials require preprocessing into each56file. The repository supplies `pathjoin` and `brsplitline`, not Sprig or an57`include` function. Preserve contextual escaping.5859Build local navigation and asset paths from `.ActionEndpoint`, which is the60portal mount, not the login URL. Keep `.LogoURL` and `.LogoDescription` useful61when the theme is meant to accept configuration. Do not embed credentials,62application-specific redirect scripts, or hardcoded user/role lists in a theme.6364Preserve the current portal refresh script and the `session` template's DOM and65script attributes. The session response blocks inline CSS/JavaScript: load66theme CSS from the same origin. Do not relax its Content Security Policy to67reuse an inline style block. Read `refresh-token-transports` if changing session68behavior; visual changes alone do not require redesigning the refresh flow.6970## Source of Truth7172Paths below are relative to the repository root:7374- `pkg/authn/ui/params.go`: UI configuration fields.75- `pkg/authn/portal.go`, `configureUserInterface`: default and override loading.76- `pkg/authn/ui/ui.go`: template functions, `Args`, `BaseURL`, and rendering.77- `pkg/authn/ui/page_templates/basic/`: current template baselines.78- `pkg/authn/ui/core/css/` and `pkg/authn/ui/core/js/`: styles and DOM consumers.79- `pkg/authn/handle_http_static.go`: public asset routing and caching.80- `pkg/authn/handle_http_session.go`: session rendering and response policy.8182Use the application's pinned dependency when it differs from this checkout.83Recompare overrides with that baseline on upgrades; do not copy an older theme's84functional omissions into a new theme.