The sign-in experience
Theming
On this page
- Introduction
- A theme in four commands
- Start with the layout
- What the layout must contain
- Overriding a page
- What validation checks
- What is not checked
- When a theme is wrong
- The pages
- Changing what a page says without touching a page
- The look, and changing it without touching a page
- Looking at what you changed
- Reading, and when
Introduction
People see Signari's pages more than any other part of it: the sign-in form, the consent screen, the two-factor challenge, the error pages. Most organisations want those pages to look like the rest of their own sites.
Every one of them is an HTML file you can replace, without a compiler. You can replace the shared frame around every page, which is enough for most organisations, or a single page. Signari checks each replacement when it starts, and keeps serving its own version of any page whose replacement would break sign-in.
Note
To change only the product name, the logo and the colours, you do not need a theme. Use a brand instead.
A theme in four commands
Copy Signari's own layout into a folder, change it, check it, and serve it:
Shellsignari theme eject -theme-dir ./theme -theme-page layout # start from the real page$EDITOR ./theme/layout.html # change the chromesignari theme check -theme-dir ./theme # exits non-zero if refusedSIGNARI_THEME_DIR=./theme signari serve
signari theme list then prints every page and where it is coming from.
Start with the layout
There are two units you can replace, and the smaller one is the one most deployments want.
layout.html is the chrome: the <head>, the logo, the footer and the shared
stylesheet, for all thirty-three pages at once. Every form, hidden field and
button stays Signari's. This is the safe case: the layout cannot drop a cross-site
request forgery (CSRF) token, because it never contained one.
An individual page is that page's content: the form, the buttons and the wording. It gives much more control, which is why the validator below exists.
If what you want is your logo, your colours and your typeface, override
layout.html and stop there.
What the layout must contain
The layout must contain three placeholders, or it is refused:
{{template "content" .}} | Where the page goes |
{{template "title" .}} | Inside <title> |
{{template "pagecss" .}} | The shared stylesheet |
Two more are optional and defined for you if you leave them out: style (rules a
single page needs) and foot (anything after the content).
.BrandLogo, .BrandName and the brand colours are supplied by
signari brand set, so an administrator can change the logo without touching a file
at all. In a theme that hardcodes an image, that command has no effect.
Overriding a page
signari theme eject -theme-dir ./theme writes all thirty-three out. Then
delete every file you do not intend to change. A file left in that directory
is a fork of one page: it stops receiving upstream fixes, including security
fixes to the page it replaces. theme list is how you see how many you are
carrying.
A page is three blocks:
HTML{{define "title"}}Sign in{{end}}{{define "style"}}<style>.card { max-width: 22rem }</style>{{end}}{{define "content"}} <form method="post" action="/login"> {{.CSRFField}} <input name="username" autocomplete="username"> <input name="password" type="password" autocomplete="current-password"> <button type="submit">Sign in</button> </form>{{end}}
The shared stylesheet is emitted before your style block, so a rule you write
wins on source order without having to out-specify anything.
What validation checks
A page override is compared against the built-in page it replaces, rendered side by side under fourteen different datasets. The requirements are not a list maintained by hand: they are read out of Signari's own page every time the binary is built, so a field added to a form later is protected in your theme too.
Three things must survive:
- Every critical value the built-in renders. The CSRF token, the authorization request, the Security Assertion Markup Language (SAML) request and relay state, the continuation URL, the invite and reset tokens, the device user code, the record being acted on.
- Every form target. A
method="post"to/logincannot become aGET, and cannot go somewhere else. - Every hidden input. By count as well as by name.
A page missing any of them can still look correct on screen. A sign-in form without its CSRF field renders and submits normally, and can also be submitted by another site's page.
Fourteen datasets are used rather than one because a page like the consent screen shows a
different form depending on what was asked for; a single render would only ever
walk one branch of the if, and the requirement in the other branch would be
invisible. Fields read inside a {{range}} are probed too.
Two more properties are checked: the page must parse, and it must render without crashing on empty data. The second matters because an error page is reached when something did not get filled in, and a theme that assumes a value is present turns a handled error into a blank response.
What is not checked
Validation does not check contrast, spelling, whether the button is visible,
whether the copy is accurate, or whether your CSS puts the form behind a header.
It does not replace loading the page. Run signari brand check for contrast, and open
/login, /consent and /mfa in a browser before you ship.
When a theme is wrong
It depends on where you are.
In a pipeline, signari theme check exits non-zero and names the file, the
page, and the specific value that went missing:
TextREFUSED the login page no longer renders the CSRF value, the CSRFField value, 1 of its 2 hidden inputs. The built-in page does, and losing it breaks the page in a way that still looks correct on screen
When Signari starts, nothing stops. The bad page is refused on its own, the built-in is served in its place, and a warning is logged. Your other overrides, including the layout, stay in force.
This difference is deliberate. If Signari refused to start, a mistyped filename
in a theme would lock everyone out of every application. The cost is that a
refused page looks normal, which is why signari doctor reports refusals, and
why theme check belongs in the deploy, before the restart.
The pages
There are thirty-three, plus three shared fragments (layout, pagecss,
captcha).
| Signing in | login mfa emailotp smsotp consent prompt done cancelled |
| Account | account signup signupdone enrol changepw connected portal |
| Recovery | recover recovery reset sent |
| Signing out | logout backchannel fclogout |
| Devices and access | device racindex |
| Errors | err federr samlerr umaclaimserr |
| User-Managed Access (UMA) | umaclaims |
| Bridges | saml formpost wsfed racview |
The four bridges are the exception to everything above, for two different reasons.
saml, formpost and wsfed are auto-posting forms (the SAML POST binding,
the form_post response mode and WS-Federation) that a browser submits inside a
redirect. The only time a person sees one is with scripting off, which is why
each carries a small self-contained stylesheet and nothing more: a logo there is
two extra requests in the middle of a sign-on, and a shared stylesheet is one
more thing that can fail to load and leave the redirect hanging.
racview is bare for the opposite reason. It is looked at for a long time, and
what fills it is somebody else's desktop; chrome around that competes with the
content, so it styles itself, stays dark in both themes, and carries no logo.
It also has a contract no other page has. /rac.js reads three element ids from
it (screen, status and disconnect), and the machine to connect to from
data-slug on #screen. The validator cannot see any of that: to it, those are
divs with no hidden input in them. Renaming one leaves a page that renders,
validates, and shows a black rectangle. If you override racview, keep the ids
and keep data-slug; rac.ViewContract is the list, and a test holds the
built-in page to it.
fclogout is not a bridge, though it was treated as one at first. It has a
heading, a sentence telling you how many applications you are being signed out
of, and a link to continue if one of them hangs. The hidden iframes are its
machinery; the page around them is read, so it carries the brand like every
other page a person sees.
Changing what a page says without touching a page
A theme directory has a locales/ subdirectory, and a file in it overrides
messages key by key:
JSON{ "login.heading": "Sign in to Example Corporation" }
That is a complete locales/en.json. login.html stays Signari's, so it keeps
receiving upstream fixes, and everything you did not mention keeps coming from
the built-in catalogue.
Change wording here, and structure in a page override. Overriding a whole page to
change one sentence forks that page's form, including its CSRF field, and a
locale file does not. A locale file is also how a language is added; Languages covers plurals, text direction and
how ui_locales is honoured.
The look, and changing it without touching a page
All thirty-three share one stylesheet, pagecss.html, built on CSS custom
properties. Overriding that alone re-colours everything without going near a
form:
CSS:root{ --page-w:26rem; /* how wide the page column is */ --radius:12px; /* the card */ --radius-sm:8px; /* inputs, buttons and notes */ --accent:#0b5fff; /* links and focus rings */ --btn-bg:#0b5fff; /* the primary button */}
The defaults match signari.dev: each page is one white card on a light grey
dotted ground. Light uses text #171717, secondary text #737373 (4.74:1 on the
card), input edges #8a8a8a (3.45:1) and rules #e5e5e5, on a #fafafa ground.
Dark uses a #171717 card on #0a0a0a, with text #fafafa, secondary text
#a3a3a3, input edges #737373 and rules #2e2e2e. Buttons and links are in the
text colour. Red #c8102e is used only as the edge of an error and in the
wordmark, never as text. Every error also says what went wrong in words. The
typeface is the system's own, because the pages' Content-Security-Policy allows
no web fonts.
Light and dark are both defined. A page follows the reader's system setting
unless <html> carries data-theme="light" or data-theme="dark", which a
layout override can set to pin one.
The greys (borders, panel fills, muted text) are mixed from the brand's
background and text once signari brand set has set both, so a custom palette
does not show the default greys among its own colours. With no colours set, the
page uses the exact values above.
Looking at what you changed
Validation proves a page still carries its CSRF token. It cannot tell you the button is invisible against your new background. To see that, render every page from the engine's source tree:
ShellSIGNARI_PAGE_PREVIEW_DIR=/tmp/pages go test ./internal/pages/ -run Preview
That writes every page rendered with realistic sample data, in four variants
(your system setting, light, dark, and one carrying brand colours), with an
index.html showing all of them at once. Serve the directory and open it.
Reading, and when
Signari reads a theme once, at startup, not on each request.
A directory being edited can hold half-written files, and serving the sign-in pages from one mid-save would break sign-in, so a change needs a restart. Reading once also means a theme cannot slow down a sign-in, and that the pages served are fixed for the life of the process, which helps during an incident.