# Make password policies available to FreeMarker

**URL:** <https://forum.keycloak.org/t/make-password-policies-available-to-freemarker/11632>\
**Category:** Miscellanaeous\
**Created:** [October 20, 2021, 11:16am UTC](https://forum.keycloak.org/t/make-password-policies-available-to-freemarker/11632 "2021-10-20T11:16:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![garronej](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/garronej/32/2831_2.png) [@garronej](https://forum.keycloak.org/u/garronej)\
**Post date:** [October 20, 2021, 11:16am UTC](https://forum.keycloak.org/t/make-password-policies-available-to-freemarker/11632/1 "2021-10-20T11:16:44Z")

</div>

Hi,  
I am the author of [keycloakify](https://github.com/InseeFrLab/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.

 ![issue_keycloak](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/e/e2bab6733c05d4e703c59191d51557b9281f43fe.png)

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

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [October 20, 2021, 1:15pm UTC](https://forum.keycloak.org/t/make-password-policies-available-to-freemarker/11632/2 "2021-10-20T13:15:43Z")

</div>

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](https://github.com/dteleguin/keycloak-dynamic-branding)

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.

---

<div class="post-metadata">

**Author:** ![garronej](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/garronej/32/2831_2.png) [@garronej](https://forum.keycloak.org/u/garronej)\
**Post date:** [October 20, 2021, 3:48pm UTC](https://forum.keycloak.org/t/make-password-policies-available-to-freemarker/11632/3 "2021-10-20T15:48:31Z")

</div>

Thank you for the tip!

---

<div class="post-metadata">

**Author:** ![jcputney](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jcputney/32/9446_2.png) [@jcputney](https://forum.keycloak.org/u/jcputney)\
**Post date:** [December 15, 2023, 2:11pm UTC](https://forum.keycloak.org/t/make-password-policies-available-to-freemarker/11632/4 "2023-12-15T14:11:19Z")

</div>

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

> **[GitHub - jcputney/keycloak-theme-additional-info-extension: Provides Password...](https://github.com/jcputney/keycloak-theme-additional-info-extension)**
>
> Provides Password Policy data as well as Realm attribute access to your Keycloak FreeMarker templates - GitHub - jcputney/keycloak-theme-additional-info-extension: Provides Password Policy data as ...

---

<div class="post-metadata">

**Author:** ![ToninoFerrara](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/toninoferrara/32/9563_2.png) [@ToninoFerrara](https://forum.keycloak.org/u/ToninoFerrara)\
**Post date:** [January 12, 2024, 4:33pm UTC](https://forum.keycloak.org/t/make-password-policies-available-to-freemarker/11632/5 "2024-01-12T16:33:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![renek95](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/renek95/32/10069_2.png) [@renek95](https://forum.keycloak.org/u/renek95)\
**Post date:** [March 26, 2024, 8:14am UTC](https://forum.keycloak.org/t/make-password-policies-available-to-freemarker/11632/6 "2024-03-26T08:14:42Z")

</div>

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.
