'Keycloak templates available variables
I'am googling for a while in order to find a documentation of all available say "variables" I can use in the various Keycloak templates.
by variable I mean all the ${xxx.yyy}
things I can use to inject some dynamic values inside the template.
Through the documentation I can find here and there some of them (like ${user.attributes}
or ${url.resourcesPath}
) but are there others than these ?
Does anyone have a reference link ?
Many Thanks
Solution 1:[1]
I did not find any easy to use documentation but I found the Keycloak Javadocs which can be helpful when you look for the *Bean
classes of this documentation. These classes seem to be the ones available in most of the templates. And their public methods will match the available properties you can use in the templates.
For example:
You want to know the properties available for the variable url
you can check the class UrlBean
in the documentation and you will find for example a method getLoginUrl
. This means you can access the property url.loginUrl
.
That's all I could find for the time being. Hope it will be helpful...
Solution 2:[2]
You can look for the template providers in Keycloak's code.
All the templates are "ftl" files filled with a map called "attributes". Keycloak has a couple of classes which fill those templates with Beans depending on the page or action as CharlyP mentioned. For example:
- FreeMarkerEmailTemplateProvider class fills the email templates.
- FreeMarkerLoginFormsProvider class fills the login templates.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Juan |
Solution 2 | kinjelom |