Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-2671

Allow additional attributes to be pushed into Freemarker templates (login and account themes)

    XMLWordPrintable

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 3.4.0.CR1
    • Component/s: None
    • Labels:

      Description

      Allow additional attributes/beans to be pushed into Freemarker templates for login and account themes by extension developers. Now set of info pushed into templates is very limited and it is not extensible.

      Developer should be able to write own extension which adds additional attributes to the Freemarker templates. Developer should have available set of informations about current request and flow (in case of login theme) to be able to prepare attributes based on it, like:

      • current KeycloakSession so developer has access to things like current Realm (RealmModel), current Client who calls flow (ClientModel) etc - it is available in 3.3.x Freemarker providers
      • current AuthenticationSessionModel in case of login theme (so info acquired from KEYCLOAK-2670 will be available there this way) - it is NOT available in 3.3.x Freemarker providers
      • current user (in account theme, but even in login theme if user is known already) - user is available in account theme and from login it should be available from AuthenticationSessionModel probably

      This mechanism should be also integrated with customizable components which show forms ( Authenticator and RequiredActionProvider), so extension developers can provide additional attributes/beans to the template if necessary from these components.

      Simplest solution should be extension by subclassing current Freemarker providers, but it is not possible as they use private fields and methods, so it is necessary to copy whole code, which makes maintenance hard (BTW FreeMarkerEmailTemplateProvider has been updated and uses protected methods in 3.3.x and it is much easier to extend it now, I like it).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              velias Vlastimil Eliáš
              Reporter:
              velias Vlastimil Eliáš
              Tester:
              Mark True Mark True (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: