Merge pull request #222 from patriot1burke/master

theme distro/docs
This commit is contained in:
Bill Burke 2014-02-18 19:00:09 -05:00
commit 01c1eed510
10 changed files with 189 additions and 15 deletions

View file

@ -36,7 +36,7 @@
<outputDirectory>keycloak/standalone/deployments</outputDirectory> <outputDirectory>keycloak/standalone/deployments</outputDirectory>
</fileSet> </fileSet>
<fileSet> <fileSet>
<directory>${project.build.directory}/unpacked/examples/themes</directory> <directory>${project.build.directory}/unpacked/themes</directory>
<outputDirectory>keycloak/standalone/configuration/themes</outputDirectory> <outputDirectory>keycloak/standalone/configuration/themes</outputDirectory>
</fileSet> </fileSet>
<fileSet> <fileSet>

View file

@ -68,6 +68,13 @@
<type>zip</type> <type>zip</type>
<outputDirectory>${project.build.directory}/unpacked</outputDirectory> <outputDirectory>${project.build.directory}/unpacked</outputDirectory>
</artifactItem> </artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-example-themes-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<outputDirectory>${project.build.directory}/unpacked</outputDirectory>
</artifactItem>
<artifactItem> <artifactItem>
<groupId>org.keycloak</groupId> <groupId>org.keycloak</groupId>
<artifactId>keycloak-wildfly-adapter-dist</artifactId> <artifactId>keycloak-wildfly-adapter-dist</artifactId>

View file

@ -25,8 +25,5 @@
<move file="target/examples/unconfigured-demo/customer-app/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/customer-app/src/main/webapp/WEB-INF/web.xml"/> <move file="target/examples/unconfigured-demo/customer-app/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/customer-app/src/main/webapp/WEB-INF/web.xml"/>
<move file="target/examples/unconfigured-demo/product-app/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/product-app/src/main/webapp/WEB-INF/web.xml"/> <move file="target/examples/unconfigured-demo/product-app/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/product-app/src/main/webapp/WEB-INF/web.xml"/>
<move file="target/examples/unconfigured-demo/database-service/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/database-service/src/main/webapp/WEB-INF/web.xml"/> <move file="target/examples/unconfigured-demo/database-service/src/main/webapp/WEB-INF/web.xml.unconfigured" tofile="target/examples/unconfigured-demo/database-service/src/main/webapp/WEB-INF/web.xml"/>
<copy todir="target/examples/themes" overwrite="true">
<fileset dir="../../examples/themes"/>
</copy>
</target> </target>
</project> </project>

View file

@ -31,6 +31,7 @@
<module>eap6-adapter-zip</module> <module>eap6-adapter-zip</module>
<module>wildfly-adapter-zip</module> <module>wildfly-adapter-zip</module>
<module>examples-docs-zip</module> <module>examples-docs-zip</module>
<module>theme-template-zip</module>
<module>war-zip</module> <module>war-zip</module>
<module>war-dist</module> <module>war-dist</module>
<module>appliance-dist</module> <module>appliance-dist</module>

View file

@ -0,0 +1,20 @@
<assembly>
<id>war-dist</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target/themes</directory>
<outputDirectory>themes</outputDirectory>
<excludes>
<exclude>**/.svn/**</exclude>
<exclude>**/target/**</exclude>
<exclude>**/*.iml</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,39 @@
<project name="example-dist" basedir="." default="all">
<target name="all">
<delete dir="target/themes"/>
<copy todir="target/themes/login/template" overwrite="true">
<fileset dir="../../forms/common-themes/src/main/resources/theme/login/base">
</fileset>
</copy>
<copy todir="target/themes/login/template" overwrite="true">
<fileset dir="../../forms/common-themes/src/main/resources/theme/login/patternfly">
</fileset>
</copy>
<copy tofile="target/themes/login/template/theme.properties" file="../../forms/common-themes/src/main/resources/theme/login/patternfly/theme.properties" overwrite="true">
<filterchain>
<linecontains negate="true">
<contains value="parent"/>
</linecontains>
</filterchain>
</copy>
<copy todir="target/themes/account/template" overwrite="true">
<fileset dir="../../forms/common-themes/src/main/resources/theme/account/base">
</fileset>
</copy>
<copy todir="target/themes/account/template" overwrite="true">
<fileset dir="../../forms/common-themes/src/main/resources/theme/account/patternfly">
</fileset>
</copy>
<copy tofile="target/themes/account/template/theme.properties" file="../../forms/common-themes/src/main/resources/theme/account/patternfly/theme.properties" overwrite="true">
<filterchain>
<linecontains negate="true">
<contains value="parent"/>
</linecontains>
</filterchain>
</copy>
<copy todir="target/themes" overwrite="true">
<fileset dir="../../examples/themes"/>
</copy>
</target>
</project>

View file

@ -0,0 +1,84 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>keycloak-parent</artifactId>
<groupId>org.keycloak</groupId>
<version>1.0-alpha-2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>keycloak-example-themes-dist</artifactId>
<packaging>pom</packaging>
<name>Keycloak Example Themes</name>
<description/>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<inherited>false</inherited>
<executions>
<execution>
<id>build-example</id>
<goals>
<goal>run</goal>
</goals>
<phase>compile</phase>
<configuration>
<target>
<ant antfile="build.xml" inheritRefs="true">
<target name="all"/>
</ant>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>assemble</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<outputDirectory>
target
</outputDirectory>
<workDirectory>
target/assembly/work
</workDirectory>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -23,6 +23,14 @@
</includes> </includes>
<outputDirectory>adapters</outputDirectory> <outputDirectory>adapters</outputDirectory>
</dependencySet> </dependencySet>
<dependencySet>
<unpack>false</unpack>
<useTransitiveDependencies>false</useTransitiveDependencies>
<includes>
<include>org.keycloak:keycloak-example-themes-dist:zip</include>
</includes>
<outputDirectory>examples</outputDirectory>
</dependencySet>
</dependencySets> </dependencySets>
<!-- <!--
<moduleSets> <moduleSets>

View file

@ -31,6 +31,12 @@
<version>${project.version}</version> <version>${project.version}</version>
<type>zip</type> <type>zip</type>
</dependency> </dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-example-themes-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>

34
docbook/reference/en/en-US/modules/themes.xml Normal file → Executable file
View file

@ -19,10 +19,10 @@
<section> <section>
<title>Creating a theme</title> <title>Creating a theme</title>
<para> <para>
There are two types of themes in Keycloak, login and account. Login themes are used to customize the There are two types of themes in Keycloak, <literal>login</literal> and <literal>account</literal>. Login themes are used to customize the
login forms, while account themes are used to customize account management. A theme consists of: login forms, while account themes are used to customize account management. A theme consists of:
<itemizedlist> <itemizedlist>
<listitem><para>FreeMarker templates</para></listitem> <listitem><para><ulink url="http://freemarker.org">FreeMarker</ulink> templates</para></listitem>
<listitem><para>Stylesheets</para></listitem> <listitem><para>Stylesheets</para></listitem>
<listitem><para>Scripts</para></listitem> <listitem><para>Scripts</para></listitem>
<listitem><para>Images</para></listitem> <listitem><para>Images</para></listitem>
@ -97,23 +97,35 @@
<programlisting>username=Your Username</programlisting> <programlisting>username=Your Username</programlisting>
</section> </section>
<section> <section>
<title>Templates</title> <title>Modifying HTML</title>
<para> <para>
For advanced use-cases where you need to modify the html structure it is also possible to override Keycloak uses <ulink url="http://freemarker.org">Freemarker Templates</ulink> in order to generate HTML.
one or more of the templates. For example to override the login page create <literal>login.ftl</literal> These templates are defined in <literal>.ftl</literal> files and can be overriden from the base theme.
inside your theme folder. The base templates all use <literal>template.ftl</literal> to create the Check out the Freemarker website on how to form a template file.
basic structure of the page. </para>
</section>
<section>
<title>Full Example Templates</title>
<para>
Keycloak comes bundled with some default themes which you cannot view or modify. The distribution
also contains full example templates which you can edit directly if you're running the Keycloak appliance
distro, or which you can install, if you're using the WAR distro. The name of these full example themes
is <literal>template</literal> and they contain a complex example for generating all pages related
to login, error displaying, oauth grant pages, and user account management.
</para> </para>
<para> <para>
The base templates are a good reference if you need to create your own templates, they can be For the Keycloak Appliance Distro, these theme files are in the directories
found inside <literal>forms/common-themes/src/main/resources/theme</literal> on GitHub or in the source <literal>${appliance-distro}/keycloak/standalone/configuration/themes/login/template</literal>
download. and <literal>${appliance-distro}/keycloak/standalone/configuration/themes/account/template</literal>.
For the WAR distro, there is a zip file in the examples directory called <literal>keycloak-example-themes-dist.zip</literal>
which you will need to unzip in the <literal>standalone/configuration</literal> or <literal>domain/configuration</literal>
directory if the JBoss or Wildfly instance you have deployed Keycloak server to.
</para> </para>
</section> </section>
</section> </section>
<section> <section>
<title>SPI</title> <title>SPIs</title>
<para> <para>
For full control of login forms and account management Keycloak provides a number of SPIs. For full control of login forms and account management Keycloak provides a number of SPIs.
</para> </para>