diff --git a/docbook/reference/en/en-US/master.xml b/docbook/reference/en/en-US/master.xml index 3af71a197e..37c07963f4 100755 --- a/docbook/reference/en/en-US/master.xml +++ b/docbook/reference/en/en-US/master.xml @@ -13,6 +13,7 @@ + ]> @@ -77,6 +78,8 @@ &SocialProviderSPI; + &Themes; + Email diff --git a/docbook/reference/en/en-US/modules/social-spi.xml b/docbook/reference/en/en-US/modules/social-spi.xml index b6de7f396b..5ab067e46f 100644 --- a/docbook/reference/en/en-US/modules/social-spi.xml +++ b/docbook/reference/en/en-US/modules/social-spi.xml @@ -1,11 +1,12 @@
Social Provider SPI - Keycloak provides an SPI to make it easy to add additional social providers. This is done by implementing the - SocialProvider - interface and providing a provider configuration file (META-INF/services/org.keycloak.social.SocialProvider). + Keycloak provides an SPI to make it easy to add additional social providers. This is done by implementing + org.keycloak.social.SocialProvider in social/core + and adding a provider configuration file (META-INF/services/org.keycloak.social.SocialProvider). - A good reference for implementing a Social Provider is the Google provider. + A good reference for implementing a Social Provider is the Google provider which you can find in social/google + on GitHub or in the source download.
\ No newline at end of file diff --git a/docbook/reference/en/en-US/modules/themes.xml b/docbook/reference/en/en-US/modules/themes.xml new file mode 100644 index 0000000000..4d36919f6e --- /dev/null +++ b/docbook/reference/en/en-US/modules/themes.xml @@ -0,0 +1,163 @@ + + Themes + + + Keycloak provides theme support for login forms and account management. This allows customizing the look + and feel of end-user facing pages so they can be integrated with your brand and applications. + + +
+ Configure theme + + To configure the theme used by a realm open the Keycloak Admin Console, select your realm + from the drop-down box in the top left corner. In the Optional Settings use the drop-down + boxes for Login Theme and Account Theme to select the theme used + by login forms and account management pages. + +
+ +
+ Creating a theme + + There are two types of themes in Keycloak, login and account. Login themes are used to customize the + login forms, while account themes are used to customize account management. A theme consists of: + + FreeMarker templates + Stylesheets + Scripts + Images + Message bundles + Theme properties + + + + A theme can extend another theme. When extending a theme you can override individual files (templates, stylesheets, etc.). + The recommended way to create a theme is to extend the base theme. The base theme provides templates + and a default message bundle. It should be possible to achieve the customization required by styling these + templates. + + + To create a new theme, create a folder in .../standalone/configuration/themes/login or + .../standalone/configuration/themes/account. The name of the folder is the name of the theme. + Then create a file theme.properties inside the theme folder. The contents of the file should be: + + parent=base + + You have now created your theme. Check that it works by configuring it for a realm. It should look the same + as the base theme as you've not added anything to it yet. The next sections will describe how to modify + the theme. +
+ Stylesheets + + A theme can have one or more stylesheets, to add a stylesheet create a file inside resources/css (for example resources/css/styles.css) + inside your theme folder. Then registering it in theme.properties by adding: + + styles=css/styles.css + + The styles property supports a space separated list so you can add as many + as you want. For example: + + styles=css/styles.css css/more-styles.css +
+
+ + A theme can have one or more scripts, to add a script create a file inside resources/js (for example resources/js/script.js) + inside your theme folder. Then registering it in theme.properties by adding: + + scripts=js/script.js + + The scripts property supports a space separated list so you can add as many + as you want. For example: + + scripts=js/script.js js/more-script.js +
+
+ Images + + To make images available to the theme add them to resources/img. They can then be used + through stylesheets. For example: + + body { + background-image: url('../img/image.jpg'); +} + + Or in templates, for example: + + <img src="${url.resourcesPath}/img/image.jpg"> +
+
+ Messages + + Text in the templates are loaded from message bundles. Currently internationalization isn't supported, + but that will be added in a later release. A theme that extends another theme will inherit all messages + from the parents message bundle, but can override individual messages. For example to replace + Username on the login form with Your Username create the file + messages/messages.properties inside your theme folder and add the following content: + + username=Your Username +
+
+ Templates + + For advanced use-cases where you need to modify the html structure it is also possible to override + one or more of the templates. For example to override the login page create login.ftl + inside your theme folder. The base templates all use template.ftl to create the + basic structure of the page. + + + The base templates are a good reference if you need to create your own templates, they can be + found inside forms/common-themes/src/main/resources/theme on GitHub or in the source + download. + +
+
+ +
+ SPI + + For full control of login forms and account management Keycloak provides a number of SPIs. + +
+ Theme SPI + + The Theme SPI allows creating different mechanisms to providing themes for the default FreeMarker based + implementations of login forms and account management. To create a theme provider you will need to implement + org.keycloak.freemarker.ThemeProvider and org.keycloak.freemarker.Theme in + forms/common-freemarker. + + + Keycloak comes with two theme providers, one that loads themes from the classpath (used by default themes) + and another that loads themes from a folder (used by custom themes). Looking at these + would be a good place to start to create your own theme provider. You can find them inside + forms/common-themes on GitHub or the source download. + +
+
+ Account SPI + + The Account SPI allows implementing the account management pages using whatever web framework or templating + engine you want. To create an Account provider implement org.keycloak.account.AccountProvider + and org.keycloak.account.Account in forms/account-api. + + + Keycloaks default account management provider is built on the FreeMarker template engine (forms/account-freemarker). + To make sure your provider is loaded you will either need to delete standalone/deployments/auth-server.war/WEB-INF/lib/keycloak-account-freemarker-1.0-alpha-1.jar + or disable it with the system property org.keycloak.account.freemarker.FreeMarkerAccountProvider. + +
+
+ Login SPI + + The Login SPI allows implementing the login forms using whatever web framework or templating + engine you want. To create a Login forms provider implement org.keycloak.login.LoginFormsProvider + and org.keycloak.login.LoginForms in forms/login-api. + + + Keycloaks default login forms provider is built on the FreeMarker template engine (forms/login-freemarker). + To make sure your provider is loaded you will either need to delete standalone/deployments/auth-server.war/WEB-INF/lib/keycloak-login-freemarker-1.0-alpha-1.jar + or disable it with the system property org.keycloak.login.freemarker.FreeMarkerLoginFormsProvider. + +
+
+ +
diff --git a/testsuite/integration/README.md b/testsuite/integration/README.md index 6eb01f160b..642865706d 100644 --- a/testsuite/integration/README.md +++ b/testsuite/integration/README.md @@ -24,6 +24,22 @@ or run org.keycloak.testutils.KeycloakServer from your favourite IDE! When starting the server it can also import a realm from a json file: mvn exec:java -Pkeycloak-server -Dimport=testrealm.json + +### Live edit of html and styles + +The Keycloak test server can load resources directly from the filesystem instead of the classpath. This allows editing html, styles and updating images without restarting the server. To make the server use resources from the filesystem start with: + + mvn exec:java -Pkeycloak-server -Dresources + +You can also specify the theme directory used by the server with: + + mvn exec:java -Pkeycloak-server -Dkeycloak.theme.dir= + +For example to use the example themes run the server with: + + mvn exec:java -Pkeycloak-server -Dkeycloak.theme.dir=examples/themes + +**NOTE:** If `keycloak.theme.dir` is specified the default themes (base, rcue and keycloak) are loaded from the classpath TOTP codes ----------