We wanted to work on the Templates and tried to get the system properties that we set earlier in the standalone.xml file like this.
</extensions>
<system-properties>
    <property name="testProp" value="TestVal"/>
</system-properties>
In the Docs of Keycloak its described like the following.
But nothing worked for us. We always get the following error Message “An internal server error has occurred”. What is the right way to get the system properties and the environment variables in the Freemarker Template?
Keycloak Theme Property Documentation is missing how to add them in the template. It is however just a bit lower in the same document
So in theme.properties could be
customPropInThemeProperties=${env.SOME_OTHER_RESOURCE_URL}
Then uses in .ftl as
${properties.customPropInThemeProperties}
In order to use system properties in the freemarker template of keycloak, do the following configuration.
Declare your system properties in the standalone.xml
<system-properties>        
        <property name="UATLogin" value="http://localhost:9090" />
</system-properties>
Add variable inside theme.properties to access the system property.
   UATURL=${UATLogin}
As an example, I have done the testing with register.ftl
<span><a href="${properties.UATURL}">${kcSanitize(msg("backToLogin"))?no_esc}</a></span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With