Customizing the Keycloak registration form

Self-registration in Keycloak can collect extra profile data, require terms acceptance, verify email and run custom checks, but each change touches the user profile, the theme and upgrade cost. This page explains the options and the work involved.

On this page

Customizing the Keycloak registration form: what it changes and when you need it

Customizing the Keycloak registration form covers the changes a team makes when it opens self-service sign-up on a realm and needs more than name and email: extra profile fields, a consent step, email verification, extra checks before an account is created, and protection against automated sign-ups. Most of these needs can be met with configuration alone, and only some require a theme or a custom authenticator. Deciding which category each requirement falls into is the first task, because it determines who maintains the change and how much it costs to keep through upgrades.

Self-registration is a built-in flow that is turned on per realm in the admin console. Its form fields come from the user profile, the declarative schema that defines each attribute, whether it is required, who can view or edit it, and in which contexts it appears. Adding a field, marking it required, or making it visible on registration is usually a profile change, not code. Keycloak's server administration guide documents the user profile and the registration settings, and the first check should be whether the requirement can be expressed there. The registration page itself is rendered by the login theme, so changing its layout, wording, or the way a field is presented means working with templates in that theme.

A custom theme is needed when the form must look or behave differently from the default templates, such as grouping fields, adding a consent checkbox with a link to your policy text, or showing conditional help. A custom authenticator or form action is needed when the decision cannot be made from profile data alone, such as checking an email domain against an allow list, calling an external verification service, or running a bot challenge your deployment has approved. Each of these adds code or template overrides that must be retested after every Keycloak upgrade, so the team should record each override and its reason before the build starts. For bot protection, confirm with your security team which options your environment permits, and confirm with the Keycloak release you run which options it supports, since these depend on version and configuration.

Registration options and when each fits

This table compares the main ways to change Keycloak self-registration: user profile fields, terms acceptance, email verification, custom form actions, theme template overrides and bot protection. Read each row for what it changes, where it lives and how much it will cost you at upgrade time. The main takeaway is that declarative settings are the cheapest to keep, and custom code or template changes need a retest on every Keycloak upgrade.

OptionWhat it changes and where it is configuredUpgrade exposure
User profile fieldsAdds or requires registration attributes through the declarative user profile, shown on the registration page for chosen contextsLow. Stays in realm configuration, but check validation rules after each upgrade
Terms and conditionsForces acceptance of terms, typically through a required action or a profile field, configured per realm or per flowLow to moderate. Wording changes are content edits, and any custom logic follows the required action SPI
Email verificationRequires users to confirm their address before first sign-in, enabled in realm login settings with working SMTPLow for settings. Email templates are a separate theme change and need testing after upgrades
Custom form actionsRuns extra checks during registration, such as invite codes or an external lookup, through a custom form action in the registration flowHigh. Custom Java code is compiled against the SPI and must be rebuilt and retested on each minor release you adopt
Theme template overridesChanges the registration.ftl page layout, fields and messages in a custom login themeModerate to high. Copied templates drift from upstream, so keep overrides small and review them on every upgrade
Bot protectionReduces automated sign-ups through a CAPTCHA or similar control. Confirm which integrations the Keycloak docs support for your version before choosing a productVaries. Built-in options are low, while third-party integrations need their own upkeep and vendor review

How to set up a customized registration flow

This sequence turns Keycloak's default self-registration into a form that collects the right profile data, verifies email ownership, asks for terms acceptance and runs any extra checks, with a branded register page. Each step ends with a test that confirms it works before the next one starts.

  1. Enable self-registration in the realm

    In the admin console, open the realm's Login settings and turn on User registration. Confirm that the Register link appears on the login page for the client you will test with. The platform team usually does this, because it changes who can create accounts in the realm, so the change should be approved by whoever owns identity risk. Done means an incognito browser session can open the registration page from the sign-in screen. If the link is missing, check that the client uses the realm browser flow and the login theme is not hiding it.

  2. Define user profile attributes and validation

    Under the realm's user profile settings, add the attributes the registration form should collect, such as first name, last name, organization or department. Set each one as required or optional for the registration context, add validators such as length or pattern checks, and decide whether unmanaged attributes are allowed. Your security or privacy team should review which fields are necessary. Done means a test sign-up with missing or malformed values is rejected with a clear message, and a valid one succeeds.

  3. Configure SMTP for verification email

    Set the realm's email server under Realm settings, using a sending account your mail team controls. Keycloak 26.8 enforces StartTLS for SMTP without plaintext fallback, so confirm that your relay offers StartTLS on the port you configure before you test. Ask the mail team to confirm SPF, DKIM and DMARC for the sending domain. Done means a test email from the admin console arrives in a mailbox outside your network with the expected sender and link host.

  4. Turn on email verification for new accounts

    Enable Verify email in the realm's Login settings so new users must confirm ownership of their address before they can sign in. Review the verification link lifetime and confirm that the frontend URL points to the public hostname users will reach, not an internal address. Done means a test sign-up sends a verification email, the link works once, and the user record shows the email as verified after the link is opened.

  5. Add terms acceptance or extra checks to the flow

    Use the registration flow to add steps beyond the default form. A terms and conditions acceptance can be implemented as a required action or a custom form step, depending on how your legal team wants acceptance recorded. Extra checks such as an external verification call or bot protection require a custom form action or authenticator, which is a code change that you must test against each Keycloak upgrade. Confirm bot protection options with your vendor and document which ones your deployment supports. Done means a test sign-up cannot finish without the new step, and the acceptance or check result is visible in the user record or logs.

  6. Customize the register template in a theme

    Create a theme that extends the base theme and override the register template (register.ftl) and any message bundle entries for the new fields and terms text. Keep overrides to this one template where possible, because each override must be reviewed when Keycloak changes its templates. Package the theme, assign it to the realm or client, and restart or redeploy as your deployment method requires. Done means the register page renders the new fields and text in a browser, and the page still validates the form when fields are left empty.

  7. Run a full test sign-up and review stored attributes

    Complete one registration from start to finish in a clean browser session: submit the form, open the verification email, confirm the account, and sign in to a test application. Then open the new user in the admin console and check that every attribute, the verified email flag and any acceptance record match what the form collected. Repeat with an invalid entry and a rejected bot check. Done means the stored values match the input, no unexpected attributes were created, and the failure cases produce no account.

Which theme templates a registration change touches

A registration change touches the login theme more than most teams expect. The self-registration page is the register.ftl template in the login theme, and it renders whatever fields the user profile exposes for the registration context. Beyond that page, the flow depends on the login-verify-email.ftl template, the email theme templates that carry the verification message, and the message bundles (messages/messages_en.properties and its siblings) that supply every label, error and link text. Before you write a single template, list which of these your change actually needs, because each one you override is a file your team must carry forward. Detailed guidance on the login theme structure and on the email templates sits in their own sibling topics, so this section only maps where registration reaches into them.

Packaging and deployment follow the same pattern for every theme change. Custom templates and resources live in a theme directory with a theme.properties file that declares the parent theme and the resources to inherit, and the directory is packaged as a JAR and copied into the server's providers folder before the build step runs. Assign the theme to the realm's login and email settings, then test the registration page in a clean browser session, since cached templates can hide errors. Ask your team who owns the build pipeline for this JAR, and confirm with your Keycloak version which template names and parent theme inheritance behave as you expect, because the upstream templates change between releases.

The upgrade cost depends on how much of the template you copy. Overriding a single message key or a small stylesheet rule is cheap to carry forward, while copying a whole template freezes its markup and logic at the version you copied it from, so each upgrade requires a manual diff against the new upstream file. Declarative user profile changes, such as adding an attribute to the registration form or marking it required, live in realm configuration and are not template edits, so they survive upgrades with little rework. Where a registration requirement can be met that way, prefer it. Where a template override is unavoidable, record the reason and the upstream version it was copied from, and include the template in your upgrade test plan.

Security risks in open self-registration

Open self-registration lets anyone create an account, so the registration form becomes an attack surface before any user is approved. The cards below pair each risk with the control to check in your realm and theme, covering both the form itself and how the admin endpoint is exposed.

Automated and spam sign-ups

Bots can submit the registration form at scale, filling your realm with fake accounts that consume email quota, pollute directories and enable later abuse. Keycloak does not ship a bot check in the registration flow by default, so a CAPTCHA or equivalent custom form action must be added and tested. Check that the flow rejects automated submissions and that the form cannot be replayed without a fresh challenge.

Keycloak docs

Email verification bypass

If verification is enabled but the account can still be used before the address is confirmed, the check protects nothing. Confirm that users cannot log in or receive access tokens until the verification link is used, and that expired or reused links are rejected. Also review whether the client scopes and required actions you rely on enforce the verified state.

Account enumeration through error messages

Messages such as "email already registered" let an attacker test which addresses hold accounts. Use generic responses for duplicate registrations and password reset requests, and compare response text and timing for existing and new addresses. Customize the message templates in your theme, then retest after each change because default messages may be overridden in more than one place.

Validation enforced only in the browser

JavaScript checks and HTML attributes improve usability but are trivially bypassed with a direct POST. Keep required fields, format rules and attribute constraints in the declarative user profile so the server enforces them, and test by submitting invalid values with an HTTP client. Custom form actions should also validate on the server side rather than trusting hidden fields.

Consent records for terms

Accepting terms in a checkbox has little value unless you can show which version a user accepted and when. Store the terms version and acceptance timestamp as user attributes, and make re-acceptance a required action when the terms change. Ask your compliance team which evidence they need, because the stored record must match the text the user actually saw.

Admin endpoint shared with public URLs

The production guide advises exposing the admin console and Administration REST API on a different hostname or context path from public frontend URLs. If registration pages and the admin surface share a host, a reverse proxy misconfiguration can expose administrative functions to anyone who can reach the form. Verify path restrictions at the proxy and confirm from outside your network that admin paths are unreachable.

Production guide

Questions teams ask before customizing registration

What does a Keycloak registration form customization cost?

The cost is the labor to design, build, test and deploy the change, plus any infrastructure for testing. Scope sets most of it: adding a few profile fields to the form is far smaller than adding an external bot check or a custom form action that calls another service. Costs are one-time for the build and recur when Keycloak upgrades require template or SPI rework. No public figure applies here. Ask for a fixed-scope quote that lists each field, action, theme template, email change and test environment, and that states which items are included in an upgrade retest.

How long does a typical registration change take?

Duration depends on how many layers the change touches. A profile field and a terms checkbox sit mostly in configuration and a theme template, while an email verification change, a custom form action and a bot protection integration each add design, testing and security review. No duration figure is supplied for this work, so ask the delivery team for a timeline tied to the written scope, including a staging test cycle and a sign-off step with your identity owners before production.

What does our team need to provide for registration work?

The work needs decisions and access more than code. Your team should define which attributes users must supply, which terms version applies and who approves its wording, how verification emails should read, and which external services (such as a bot protection or fraud check) are approved for use. Engineers need a staging realm, a test SMTP setup, and a named contact who can confirm how new accounts flow into downstream systems. Missing answers on these points are the most common cause of rework.

Can our own team customize registration without a partner?

Yes, if your team already runs Keycloak in production and is comfortable with realm configuration, the user profile, FreeMarker theme templates and Java packaging for SPI providers. Adding a profile field or a terms page is a common internal task. A partner adds the most value for custom form actions, bot protection integrations and security review of the new flow, where mistakes can open account creation to abuse. Compare your team's skills against those items before deciding.

How do registration changes affect Keycloak upgrades?

Registration customizations carry upgrade exposure in proportion to how much they copy or override. Declarative user profile settings and realm configuration usually survive upgrades, while copied theme templates can drift when Keycloak changes the underlying page or message keys. Custom authenticators or form actions depend on SPI interfaces that can change between releases. The Keycloak project says breaking changes in a minor release are opt-in, but your code still needs a retest on each target version. Keep overrides minimal and document each one.

How do we keep bot protection and verification from blocking real users?

Start by measuring the sign-up path you already have, then add checks in steps so that legitimate users are not locked out. Bot protection options, email verification and custom form actions each trade friction against abuse prevention, and the right setting depends on your user base and risk model. Test with a range of browsers, languages, email providers and assistive technologies. Agree on a support path for users who fail a check, and record the thresholds you chose so security and support teams can review them.

What evidence should we keep for a registration change?

Keep a record of what the registration flow requires, why each field and terms version exists, and who approved it. Auditors and security reviewers usually ask how account creation is controlled, how verification works and how changes are tested before release. Store the realm export, theme version, SPI build, test results and approval record together under change control. DeployOpen prepares systems, controls and evidence for compliance assessments, but independent auditors issue any report or certification, so confirm the evidence list with your assessor first.

How a self-registration request moves through Keycloak

The flow starts when a visitor opens the register page, which the login theme renders on the public frontend hostname. The submitted user profile passes through the registration flow, where validation and any custom form action run before Keycloak stores the pending user and sends the verification email. The user completes sign-in only after confirming the link. The admin hostname sits behind a separate boundary, so administrators reviewing or changing the flow never share a path with public traffic. Check that the form action and email steps behave as you expect before opening registration.

Public registration path, with the admin hostname kept on a separate boundary.

Limits to confirm in your environment

Several parts of a custom registration flow depend on the exact Keycloak version, the SMTP provider and the distribution you run, and none of them is settled by reading this page. The cards below list the points to confirm with vendor documentation and your own tests before the design is final.

Bot protection support per version

Captcha and other bot checks are usually added through a custom form action or a theme template, and which integrations work depends on your Keycloak version. Ask for the bot protection options your target version documents, then confirm that the chosen integration loads on the registration page and passes server-side verification. Test with the same browser and proxy setup your users will have, because a check that works on a developer laptop can fail behind a corporate proxy or a strict content security policy.

Keycloak docs

Custom form action behavior across upgrades

A custom form action is code you own, and the registration SPI it implements can change between releases. Keycloak's upgrade notes describe breaking changes, and the project says breaking changes in a minor release are opt-in. Read the upgrade notes for every release between your current and target versions, rebuild the provider against the new version, and run the full registration path in a staging realm before each upgrade.

Minor releases a year
Four
Upgrade guide

SMTP provider limits for verification email

Email verification and the registration confirmation depend on your SMTP provider's sending rate, daily quotas, sender domain authentication and bounce handling. Ask the provider for its documented limits and whether it accepts the STARTTLS settings Keycloak enforces in the 26.8 line. Measure delivery to the mailbox providers your users actually use, and confirm that a burst of sign-ups during a launch does not exhaust your quota and block legitimate verification mail.

Translation coverage for new fields

Every field you add to the registration form needs labels, validation messages and email text in each language your users use. Confirm which message bundles your realm enables and whether the translations you need already exist for the release you run. Check that new attributes show the right text on the account page and in error states, because a missing key often appears as a raw key name rather than an error the user can act on.

Red Hat build differences from upstream

If your organization runs the Red Hat build of Keycloak rather than the upstream release, the packaged version, supported providers and template behavior may differ from the upstream documentation you read. Ask Red Hat which release your subscription covers, whether custom providers and themes are supported in that build, and whether the registration and bot protection components match the upstream behavior you tested. Repeat your registration tests on the exact distribution you deploy.

Red Hat build page

How registration customizations affect Keycloak upgrades

Every customized registration template and custom provider has to be retested on each Keycloak upgrade, because the project plans four minor releases a year and says breaking changes in a minor release are opt-in. The Keycloak blog post on backwards compatibility explains that policy. Opt-in changes are good news, but a registration form that works on your current version may still rely on defaults that change when you adopt a newer release. Keep a list of every file you override in the registration theme (typically register.ftl, register-user-profile.ftl and any terms or verification templates), plus each custom form action or authenticator in the registration flow. Those are the items to re-verify after each upgrade, not the whole theme.

The 26.8 upgrade notes matter most for sign-up email. Enforced SMTP StartTLS without plaintext fallback means a mail relay that accepted unencrypted connections will stop delivering verification emails, and users will see registrations that never complete. Confirm your SMTP settings and send a test registration against a staging realm before you promote the upgrade. Also confirm that any custom email theme still renders, since verification and welcome messages depend on it. Login failures are now persisted to the database by default, so check that your monitoring and retention plans cover the larger event volume on busy sign-up pages.

The second decision is how the database schema migrates. By default Keycloak migrates its schema automatically at startup, which is simple for small deployments but means a registration outage can start with the new pods rather than a planned change window. Manual migration, where administrators apply the SQL themselves, is the approach the upgrading guide suggests for large deployments, and it gives you a reviewed script to test against a copy of production. Whichever you choose, record it in the upgrade runbook and keep the operator on manual approval mode if you run the Keycloak Operator, so a registration-affecting change never lands without review.

How DeployOpen works on this

DeployOpen plans, customizes, tests and documents Keycloak inside your own infrastructure, including the registration flow. Work starts from a written scope that sets which fields, checks and templates change, and the result is a handover your team can operate and upgrade.

How we scope

  • Scope lists the registration fields, terms wording, verification method and any extra form actions to be changed.
  • Scope names the realms, clients and locales where the new registration flow applies.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.

How we build

  • Changes are made in a versioned theme and realm configuration, so every edit can be reviewed and reproduced.
  • Templates are overridden only where the scope requires it, which keeps later Keycloak upgrades cheaper.
  • Registration paths are tested with new, invalid, duplicate and bot-flagged sign-ups before sign-off.

How we hand over

  • Handover covers the theme JAR, realm settings, template change list and the configuration steps needed to redeploy.
  • Documentation explains each changed template, the user profile attributes added and how to test them after an upgrade.
  • Your team receives a walkthrough of the registration flow and the checks an administrator should repeat after changes.

How we support

  • Ongoing support, upgrades and continuous testing of the registration flow are available as retainers.
  • Support can cover retesting registration after each Keycloak minor release before your rollout.
  • Retainer scope, response expectations and fees are set in a written quote based on your environment.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.