[keycloak-dev] pluggable templates

Stian Thorgersen stian at redhat.com
Tue Jan 7 05:48:38 EST 2014


The way things are at the moment is not how we want to have it in the long run.

How it's envisioned to work is that users can create themes. A theme can extend another theme and can specify:

* Config (logo, hide/display fields, etc)
* Resources (css and images)
* Templates (html)

A theme can be bundled in a JAR and should be automatically discovered if it's on KC's class-path, but it should also be possible to define it through the admin console. In the admin console at first we could just let users upload a zip/jar with all the artefacts required, but in the future we could let them edit css/templates and upload resources directly through the console.

This would make it easy for a user to for example only modify the login forms, while using the default account management. In the default theme we can also make it fairly configurable through config options and making it css-friendly so that most users should be able to do what they want without having to create templates. I would hope that at least 80% of users that want to customize the forms can do so through config and css, while less than 20% would have to create templates to make it do exactly what they want.

Providing a mechanism to do this with a web framework would require users to basically build everything from scratch, which would be a lot more work. Also, if you're talking about JavaEE web apps that's not available in LiveOak. They would still need to understand some basic Freemarker stuff as we need a template engine for emails.

I'm quite convinced that using a template engine is the way to go, and fairly confident that Freemarker is a good choice. End of the day though I think that most things in Keycloak should be pluggable, so we should have a forms SPI, with the default implementation based on Freemaker (and customizable themes) while it would be possible for someone to implement something else by just dropping in a different JAR with an implementation of the forms SPI. That could use JSF, AngularJS or whatever. We could also support both returning html directly from the forms SPI (template style) or a redirect to a url (jsf or whatever style).

----- Original Message -----
> From: "Bill Burke" <bburke at redhat.com>
> To: keycloak-dev at lists.jboss.org
> Sent: Friday, 3 January, 2014 5:02:57 PM
> Subject: [keycloak-dev] pluggable templates
> 
> Was thinking about pluggable templates for login, oauth screen, user
> acct mgmt, etc...
> 
> Why force users to use Freemarker?  Why not allow them to create a
> directory within the Keycloak Server WAR and use whatever framework they
> want to use?  Then to choose a template, you just specify the URLs for
> login, oauth, user acct mgmt, etc?
> 
> What sucks is, because we're using Freemarker and everything is bundled
> up in JARs, there's no easy way for users to copy/paste a template and
> create and play with their own on the fly.
> 
> Just food for thought for after Alpha 1 release.
> 
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
> 


More information about the keycloak-dev mailing list