Make password policies available to FreeMarker

Hi,
I am the author of keycloakify. We love the User profile feature, it enables users to create themes that perform field validation from the front end which dramatically improves the end-user registration experience.

So, we can validate all fields but the password and password confirm.
It would be great if we could, one way or the other, have access in FreeMarker to the description of the password policies defined in the administration console.

Anyway, thank you for your great work,

Regards

First of all, keycloakify is awesome, and I know of several companies now relying on it to build their login themes.

It is possible to extend the FreeMarkerLoginFormsProvider with the additional attributes you need. There is an example of it here: GitHub - dteleguin/keycloak-dynamic-branding: Example of dynamically branded login theme for Keycloak

Getting things quickly in the Keycloak trunk can be difficult, so I’d recommend building an extension to start with, and then working on going through the process of proposing it to the Keycloak maintainers. Let me know if I can help with the extension.

1 Like

Thank you for the tip!

In case anyone comes here looking for this functionality, I’ve created an extension that exposes the password policies to templates.

1 Like

Is there a example on how to use the extension in the Keycloak FreeMarker template?

Hey there!

Thanks for implementing @jcputney.

Do you may know if there is a problem using your lib with keycloak 21? I am getting errors that passwordPolicies and reamlAttributes is evaluated as null trying to use them in my ftl files.

Thank you.