# Inject dynamic variable from backend java to freemarker template

**URL:** <https://forum.keycloak.org/t/inject-dynamic-variable-from-backend-java-to-freemarker-template/26711>\
**Category:** Extending the server\
**Created:** [June 28, 2024, 6:09am UTC](https://forum.keycloak.org/t/inject-dynamic-variable-from-backend-java-to-freemarker-template/26711 "2024-06-28T06:09:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![michael.carter.kbr](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/michael.carter.kbr/32/10324_2.png) [@michael.carter.kbr](https://forum.keycloak.org/u/michael.carter.kbr)\
**Post date:** [July 3, 2024, 2:12pm UTC](https://forum.keycloak.org/t/inject-dynamic-variable-from-backend-java-to-freemarker-template/26711/3 "2024-07-03T14:12:11Z")

</div>

I haven’t had a chance to update login.ftl to check, but I was able to extend the FreeMarkerLoginFOrmsProviderFactory and FreeMarkerLoginFormsProvider successfully.  
I believe what you need is to add the file under resources\META-INF\service  
`org.keycloak.forms.login.LoginFormsProviderFactory`  
the contents are then the full classname of your factory.  
FYI - I am using docker also, but did NOT change my spi-login-provider in the command line

 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/c/c523a7856a516c47a14cf289bdad365d5cc6dd61.png)

If you get the source, you will see this is done in the testSuite - `testsuite\integration-arquillian\servers\auth-server\services\testsuite-providers\src\main\resources\META-INF\services`

---

_[View the full topic](https://forum.keycloak.org/t/inject-dynamic-variable-from-backend-java-to-freemarker-template/26711)._
