This is the documentation for v8, checkout the latest version
Keycloakify
v8
  • Keycloakify
  • Release Notes & Upgrade Instructions
  • FAQ
v8
  • ๐Ÿ‘จโ€๐Ÿ’ปQuick start
  • ๐Ÿ”ฉKeycloakify in my App
  • ๐Ÿ“งEmail customization
  • โœ’๏ธTerms and conditions
  • โœ…Realtime input validation and custom registration fields
  • โš ๏ธLimitations
  • ๐Ÿ”งEnvironnement Variables
  • ๐ŸŒŽi18n: msg(...)
  • ๐Ÿ“–Build options
  • ๐Ÿ’‚Email domain acceptlist
  • ๐Ÿ›‘Keycloak error in log
  • ๐ŸŒ‰Context persistence
  • ๐Ÿ’ŸContributing
  • ๐Ÿค”How it works
  • โฌ†๏ธMigration guides
    • โฌ†๏ธv7 -> v8
    • โฌ†๏ธv6 -> v7
    • โฌ†๏ธv6.x -> v6.12
    • โฌ†๏ธv5 -> v6
Powered by GitBook
On this page

Was this helpful?

Realtime input validation and custom registration fields

PreviousTerms and conditionsNextLimitations

Last updated 2 days ago

Was this helpful?

In reality the regexp used in this gif doesn't work server side, the regexp pattern should be ^[^@]@gmail\.com$ (the RegExp should match the whole string) ๐Ÿ˜ฌ.

User Profile is a Keycloak feature that enables to , what information you want to collect on your users in the register page and to validate inputs !

User profile is only available in Keycloak 15 and newer and it's not enabled by default, you have, to start keywloak with the extra parameter:

How you would pass this parameter in practice depend of the Docker image/Helm chart that you are using. . With older Keycloak distribution you can also use JAVA_OPS environement variable

, . But the default way, with the official docker image is .

The feature also need to be or you won't see the tab.

Keycloakify provides client side validation out of the box but for customizing the registration experience you'll have customize register-user-profile.ftl

Example in the starter project:

Password validation

This limitation means that we can't provide immediate feedback to the user on the client side about the validity of their chosen password. Only after the user clicks on 'Register' will they receive an error if the chosen password does not adhere to the server-defined password policy.

Getting your custom user attribute to be included in the JWT

If you register you'll see that you have to select if your are a cat or dog person.

This appear because, on my keycloak server I have configured a custom user profile attribute.

And when the user is connecte, it's choice appear in the JWT

This work because I have created the following mapper in my Keycloak configuration pannel:

  • Name: Favourite pet

  • Mapper type: User attribute

  • User attribute: favourite_pet

  • Token claim name: favourite_pet

  • Claim JSON type: string

You can establish guidelines for what constitutes a valid password, such as a minimum length, by utilizing the Keycloak Admin UI under 'Authentication -> Password Policy'. However, as of now, .

Should you insist on implementing client-side password validation, , although it's not typically recommended. The reason for this is potential confusion for users if the validator defined in your theme does not align with the server's password policy.

In .

Go to clients -> -> Mappers

โœ…
Keycloak does not support front-end validation of passwords
you can pass validators to the useFormValidation function
the public deployment of the starter project
starter (name of your client)
define, from the admin console
on the frontend, in realtime
--features=declarative-user-profile
Here is an example with docker compose
docker example
helm example
this
enabled the feature in the console
keycloakify-starter/RegisterUserProfile.tsx at main ยท keycloakify/keycloakify-starterGitHub
The RegisterUserProfile page...
keycloakify-starter/UserProfileFormFields.tsx at main ยท keycloakify/keycloakify-starterGitHub
...but this is where the magic happens
Cloud IAM - Keycloak Identity and Access Management as a Service
Feeling overwhelmed? Check out our exclusive sponsor's Cloud IAM consulting services to simplify your experience.
Logo
Logo
Logo