diff --git a/examples/themes/README.md b/examples/themes/README.md
index fccb847942..9f555bcf70 100644
--- a/examples/themes/README.md
+++ b/examples/themes/README.md
@@ -6,7 +6,24 @@ Sunrise Login Theme
Example login theme that changes the look of the login forms.
-To use the theme copy `login/sunrise` to `standalone/configuration/themes/login/`. Open the admin console, select your realm, click on `Theme`. In the dropdown for `Login Theme` select `sunrise`. Click `Save` and login to the realm to see the new theme in action.
+To use the theme you can either deploy it as a module or copy it to the Keycloaks themes folder.
+
+To deploy as a module run:
+
+ mvn clean install
+ $KEYCLOAK_HOME/bin/jboss-cli.sh --command="module add --name=org.keycloak.example.sunrisetheme --resources=target/keycloak-example-themes.jar"
+
+Then open $KEYCLOAK_HOME/standalone/configuration/keycloak-server.json and register the theme module by adding:
+
+ "theme": {
+ "module": {
+ "modules": [ "org.keycloak.example.sunrisetheme" ]
+ }
+ }
+
+Alternatively you can copy `src/main/resources/theme/login` to `standalone/configuration/themes/login/`.
+
+Once you've added the theme open the admin console, select your realm, click on `Theme`. In the dropdown for `Login Theme` select `sunrise`. Click `Save` and login to the realm to see the new theme in action.
Change Logo Theme
@@ -14,14 +31,30 @@ Change Logo Theme
Example themes for login forms, account management, admin console and welcome pages that changes the Keycloak logo.
-To use the themes copy:
+To use the themes you can either deploy it as a module or copy it to the Keycloaks themes folder.
+
+To deploy as a module run:
+
+ mvn clean install
+ $KEYCLOAK_HOME/bin/jboss-cli.sh --command="module add --name=org.keycloak.example.logotheme --resources=target/keycloak-example-themes.jar"
+
+Then open $KEYCLOAK_HOME/standalone/configuration/keycloak-server.json and register the theme module by adding:
+
+ "theme": {
+ "module": {
+ "modules": [ "org.keycloak.example.logotheme" ]
+ }
+ }
+
+Alternatively you can copy:
* `account/logo-example` to `standalone/configuration/themes/account/`
* `login/logo-example` to `standalone/configuration/themes/login/`
* `admin/logo-example` to `standalone/configuration/themes/admin/`
* `welcome/logo-example` to `standalone/configuration/themes/welcome/`
-Open the admin console, select your realm, click on `Theme`. In the dropdowns for `Login Theme`, `Account Theme` and `Admin Console Theme` select `logo-example`. Click `Save` and login to the realm to see the new theme in action.
+
+Once you've added the theme open the admin console, select your realm, click on `Theme`. In the dropdowns for `Login Theme`, `Account Theme` and `Admin Console Theme` select `logo-example`. Click `Save` and login to the realm to see the new theme in action.
To change the theme for the welcome pages open `standalone/configuration/keycloak-server.json` find the config for `theme` and add 'welcomeTheme':
diff --git a/examples/themes/pom.xml b/examples/themes/pom.xml
new file mode 100755
index 0000000000..842c11775b
--- /dev/null
+++ b/examples/themes/pom.xml
@@ -0,0 +1,30 @@
+
+
+ keycloak-parent
+ org.keycloak
+ 1.2.0.Beta1-SNAPSHOT
+ ../../pom.xml
+
+ Themes Examples
+
+ 4.0.0
+
+ keycloak-example-themes
+ jar
+
+
+ keycloak-example-themes
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
+
+
+
+
+
diff --git a/examples/themes/src/main/resources/META-INF/keycloak-themes.json b/examples/themes/src/main/resources/META-INF/keycloak-themes.json
new file mode 100644
index 0000000000..12ee694ecd
--- /dev/null
+++ b/examples/themes/src/main/resources/META-INF/keycloak-themes.json
@@ -0,0 +1,9 @@
+{
+ "themes": [{
+ "name" : "logo-example",
+ "types": [ "admin", "account", "login", "welcome" ]
+ }, {
+ "name" : "sunrise",
+ "types": [ "login" ]
+ }]
+}
diff --git a/examples/themes/account/logo-example/resources/css/account.css b/examples/themes/src/main/resources/theme/account/logo-example/resources/css/account.css
similarity index 100%
rename from examples/themes/account/logo-example/resources/css/account.css
rename to examples/themes/src/main/resources/theme/account/logo-example/resources/css/account.css
diff --git a/examples/themes/account/logo-example/resources/img/red-hat-logo.png b/examples/themes/src/main/resources/theme/account/logo-example/resources/img/red-hat-logo.png
similarity index 100%
rename from examples/themes/account/logo-example/resources/img/red-hat-logo.png
rename to examples/themes/src/main/resources/theme/account/logo-example/resources/img/red-hat-logo.png
diff --git a/examples/themes/account/logo-example/theme.properties b/examples/themes/src/main/resources/theme/account/logo-example/theme.properties
similarity index 100%
rename from examples/themes/account/logo-example/theme.properties
rename to examples/themes/src/main/resources/theme/account/logo-example/theme.properties
diff --git a/examples/themes/admin/logo-example/resources/css/overrides.css b/examples/themes/src/main/resources/theme/admin/logo-example/resources/css/overrides.css
similarity index 100%
rename from examples/themes/admin/logo-example/resources/css/overrides.css
rename to examples/themes/src/main/resources/theme/admin/logo-example/resources/css/overrides.css
diff --git a/examples/themes/admin/logo-example/resources/img/red-hat-logo.png b/examples/themes/src/main/resources/theme/admin/logo-example/resources/img/red-hat-logo.png
similarity index 100%
rename from examples/themes/admin/logo-example/resources/img/red-hat-logo.png
rename to examples/themes/src/main/resources/theme/admin/logo-example/resources/img/red-hat-logo.png
diff --git a/examples/themes/admin/logo-example/theme.properties b/examples/themes/src/main/resources/theme/admin/logo-example/theme.properties
similarity index 100%
rename from examples/themes/admin/logo-example/theme.properties
rename to examples/themes/src/main/resources/theme/admin/logo-example/theme.properties
diff --git a/examples/themes/login/logo-example/resources/css/login.css b/examples/themes/src/main/resources/theme/login/logo-example/resources/css/login.css
similarity index 100%
rename from examples/themes/login/logo-example/resources/css/login.css
rename to examples/themes/src/main/resources/theme/login/logo-example/resources/css/login.css
diff --git a/examples/themes/login/logo-example/resources/img/red-hat-logo.png b/examples/themes/src/main/resources/theme/login/logo-example/resources/img/red-hat-logo.png
similarity index 100%
rename from examples/themes/login/logo-example/resources/img/red-hat-logo.png
rename to examples/themes/src/main/resources/theme/login/logo-example/resources/img/red-hat-logo.png
diff --git a/examples/themes/login/logo-example/theme.properties b/examples/themes/src/main/resources/theme/login/logo-example/theme.properties
similarity index 100%
rename from examples/themes/login/logo-example/theme.properties
rename to examples/themes/src/main/resources/theme/login/logo-example/theme.properties
diff --git a/examples/themes/login/sunrise/resources/css/styles.css b/examples/themes/src/main/resources/theme/login/sunrise/resources/css/styles.css
similarity index 100%
rename from examples/themes/login/sunrise/resources/css/styles.css
rename to examples/themes/src/main/resources/theme/login/sunrise/resources/css/styles.css
diff --git a/examples/themes/login/sunrise/resources/img/bkgrnd.jpg b/examples/themes/src/main/resources/theme/login/sunrise/resources/img/bkgrnd.jpg
similarity index 100%
rename from examples/themes/login/sunrise/resources/img/bkgrnd.jpg
rename to examples/themes/src/main/resources/theme/login/sunrise/resources/img/bkgrnd.jpg
diff --git a/examples/themes/login/sunrise/resources/img/logo.png b/examples/themes/src/main/resources/theme/login/sunrise/resources/img/logo.png
similarity index 100%
rename from examples/themes/login/sunrise/resources/img/logo.png
rename to examples/themes/src/main/resources/theme/login/sunrise/resources/img/logo.png
diff --git a/examples/themes/login/sunrise/theme.properties b/examples/themes/src/main/resources/theme/login/sunrise/theme.properties
similarity index 100%
rename from examples/themes/login/sunrise/theme.properties
rename to examples/themes/src/main/resources/theme/login/sunrise/theme.properties
diff --git a/examples/themes/welcome/logo-example/resources/index.html b/examples/themes/src/main/resources/theme/welcome/logo-example/resources/index.html
similarity index 100%
rename from examples/themes/welcome/logo-example/resources/index.html
rename to examples/themes/src/main/resources/theme/welcome/logo-example/resources/index.html
diff --git a/examples/themes/welcome/logo-example/resources/red-hat-logo.png b/examples/themes/src/main/resources/theme/welcome/logo-example/resources/red-hat-logo.png
similarity index 100%
rename from examples/themes/welcome/logo-example/resources/red-hat-logo.png
rename to examples/themes/src/main/resources/theme/welcome/logo-example/resources/red-hat-logo.png
diff --git a/examples/themes/welcome/logo-example/theme.properties b/examples/themes/src/main/resources/theme/welcome/logo-example/theme.properties
similarity index 100%
rename from examples/themes/welcome/logo-example/theme.properties
rename to examples/themes/src/main/resources/theme/welcome/logo-example/theme.properties
diff --git a/forms/common-themes/pom.xml b/forms/common-themes/pom.xml
index 04ea6bc30e..70b057b668 100755
--- a/forms/common-themes/pom.xml
+++ b/forms/common-themes/pom.xml
@@ -47,6 +47,11 @@
jboss-logging
provided
+
+ org.codehaus.jackson
+ jackson-core-asl
+ provided
+
diff --git a/forms/common-themes/src/main/java/org/keycloak/theme/DefaultKeycloakThemeProvider.java b/forms/common-themes/src/main/java/org/keycloak/theme/DefaultKeycloakThemeProvider.java
deleted file mode 100644
index a2776c5062..0000000000
--- a/forms/common-themes/src/main/java/org/keycloak/theme/DefaultKeycloakThemeProvider.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.keycloak.theme;
-
-import org.keycloak.freemarker.Theme;
-import org.keycloak.freemarker.ThemeProvider;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Stian Thorgersen
- */
-public class DefaultKeycloakThemeProvider implements ThemeProvider {
-
- public static final String BASE = "base";
- public static final String PATTERNFLY = "patternfly";
- public static final String KEYCLOAK = "keycloak";
-
- private static Set ACCOUNT_THEMES = new HashSet();
- private static Set LOGIN_THEMES = new HashSet();
- private static Set ADMIN_THEMES = new HashSet();
- private static Set EMAIL_THEMES = new HashSet();
- private static Set WELCOME_THEMES = new HashSet();
- private static Set COMMON_THEMES = new HashSet();
-
- static {
- Collections.addAll(ACCOUNT_THEMES, BASE, PATTERNFLY, KEYCLOAK);
- Collections.addAll(LOGIN_THEMES, BASE, PATTERNFLY, KEYCLOAK);
- Collections.addAll(ADMIN_THEMES, BASE, PATTERNFLY, KEYCLOAK);
- Collections.addAll(EMAIL_THEMES, KEYCLOAK);
- Collections.addAll(WELCOME_THEMES, KEYCLOAK);
- Collections.addAll(COMMON_THEMES, KEYCLOAK);
- }
-
- @Override
- public int getProviderPriority() {
- return 0;
- }
-
- @Override
- public Theme getTheme(String name, Theme.Type type) throws IOException {
- if (hasTheme(name, type)) {
- return new ClassLoaderTheme(name, type, getClass().getClassLoader());
- } else {
- return null;
- }
- }
-
- @Override
- public Set nameSet(Theme.Type type) {
- switch (type) {
- case LOGIN:
- return LOGIN_THEMES;
- case ACCOUNT:
- return ACCOUNT_THEMES;
- case ADMIN:
- return ADMIN_THEMES;
- case EMAIL:
- return EMAIL_THEMES;
- case WELCOME:
- return WELCOME_THEMES;
- case COMMON:
- return COMMON_THEMES;
- default:
- return Collections.emptySet();
- }
- }
-
- @Override
- public boolean hasTheme(String name, Theme.Type type) {
- return nameSet(type).contains(name);
- }
-
- @Override
- public void close() {
- }
-
-}
diff --git a/forms/common-themes/src/main/java/org/keycloak/theme/DefaultKeycloakThemeProviderFactory.java b/forms/common-themes/src/main/java/org/keycloak/theme/DefaultKeycloakThemeProviderFactory.java
deleted file mode 100755
index 807e15c8f6..0000000000
--- a/forms/common-themes/src/main/java/org/keycloak/theme/DefaultKeycloakThemeProviderFactory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.keycloak.theme;
-
-import org.keycloak.Config;
-import org.keycloak.freemarker.ThemeProvider;
-import org.keycloak.freemarker.ThemeProviderFactory;
-import org.keycloak.models.KeycloakSession;
-import org.keycloak.models.KeycloakSessionFactory;
-
-/**
- * @author Stian Thorgersen
- */
-public class DefaultKeycloakThemeProviderFactory implements ThemeProviderFactory {
-
- private DefaultKeycloakThemeProvider themeProvider;
-
- @Override
- public ThemeProvider create(KeycloakSession session) {
- return themeProvider;
- }
-
- @Override
- public void init(Config.Scope config) {
- themeProvider = new DefaultKeycloakThemeProvider();
- }
-
- @Override
- public void postInit(KeycloakSessionFactory factory) {
-
- }
-
- @Override
- public void close() {
- themeProvider = null;
- }
-
- @Override
- public String getId() {
- return "default";
- }
-
-}
diff --git a/forms/common-themes/src/main/java/org/keycloak/theme/JarThemeProvider.java b/forms/common-themes/src/main/java/org/keycloak/theme/JarThemeProvider.java
new file mode 100644
index 0000000000..7e83ca4bf4
--- /dev/null
+++ b/forms/common-themes/src/main/java/org/keycloak/theme/JarThemeProvider.java
@@ -0,0 +1,50 @@
+package org.keycloak.theme;
+
+import org.keycloak.freemarker.Theme;
+import org.keycloak.freemarker.ThemeProvider;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Stian Thorgersen
+ */
+public class JarThemeProvider implements ThemeProvider {
+
+ private Map> themes;
+
+ public JarThemeProvider(Map> themes) {
+ this.themes = themes;
+ }
+
+ @Override
+ public int getProviderPriority() {
+ return 0;
+ }
+
+ @Override
+ public Theme getTheme(String name, Theme.Type type) throws IOException {
+ return hasTheme(name, type) ? new ClassLoaderTheme(name, type, getClass().getClassLoader()) : null;
+ }
+
+ @Override
+ public Set nameSet(Theme.Type type) {
+ if (themes.containsKey(type)) {
+ return themes.get(type).keySet();
+ } else {
+ return Collections.emptySet();
+ }
+ }
+
+ @Override
+ public boolean hasTheme(String name, Theme.Type type) {
+ return themes.containsKey(type) && themes.get(type).containsKey(name);
+ }
+
+ @Override
+ public void close() {
+ }
+
+}
diff --git a/forms/common-themes/src/main/java/org/keycloak/theme/JarThemeProviderFactory.java b/forms/common-themes/src/main/java/org/keycloak/theme/JarThemeProviderFactory.java
new file mode 100644
index 0000000000..bcd0316939
--- /dev/null
+++ b/forms/common-themes/src/main/java/org/keycloak/theme/JarThemeProviderFactory.java
@@ -0,0 +1,110 @@
+package org.keycloak.theme;
+
+import org.keycloak.Config;
+import org.keycloak.freemarker.Theme;
+import org.keycloak.freemarker.ThemeProvider;
+import org.keycloak.freemarker.ThemeProviderFactory;
+import org.keycloak.models.KeycloakSession;
+import org.keycloak.models.KeycloakSessionFactory;
+import org.keycloak.util.JsonSerialization;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Stian Thorgersen
+ */
+public class JarThemeProviderFactory implements ThemeProviderFactory {
+
+ protected static final String KEYCLOAK_THEMES_JSON = "META-INF/keycloak-themes.json";
+ protected static Map> themes = new HashMap<>();
+
+ public static class ThemeRepresentation {
+ private String name;
+ private String[] types;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String[] getTypes() {
+ return types;
+ }
+
+ public void setTypes(String[] types) {
+ this.types = types;
+ }
+ }
+
+ public static class ThemesRepresentation {
+ private ThemeRepresentation[] themes;
+
+ public ThemeRepresentation[] getThemes() {
+ return themes;
+ }
+
+ public void setThemes(ThemeRepresentation[] themes) {
+ this.themes = themes;
+ }
+ }
+
+ @Override
+ public ThemeProvider create(KeycloakSession session) {
+ return new JarThemeProvider(themes);
+ }
+
+ @Override
+ public void init(Config.Scope config) {
+ try {
+ ClassLoader classLoader = getClass().getClassLoader();
+ Enumeration resources = classLoader.getResources(KEYCLOAK_THEMES_JSON);
+ while (resources.hasMoreElements()) {
+ loadThemes(classLoader, resources.nextElement().openStream());
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to load themes", e);
+ }
+ }
+
+ @Override
+ public void postInit(KeycloakSessionFactory factory) {
+ }
+
+ @Override
+ public void close() {
+ }
+
+ @Override
+ public String getId() {
+ return "jar";
+ }
+
+ protected void loadThemes(ClassLoader classLoader, InputStream themesInputStream) {
+ try {
+ ThemesRepresentation themesRep = JsonSerialization.readValue(themesInputStream, ThemesRepresentation.class);
+
+ for (ThemeRepresentation themeRep : themesRep.getThemes()) {
+ for (String t : themeRep.getTypes()) {
+ Theme.Type type = Theme.Type.valueOf(t.toUpperCase());
+ if (!themes.containsKey(type)) {
+ themes.put(type, new HashMap());
+ }
+ themes.get(type).put(themeRep.getName(), new ClassLoaderTheme(themeRep.getName(), type, classLoader));
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to load themes", e);
+ }
+ }
+
+}
diff --git a/forms/common-themes/src/main/resources/META-INF/keycloak-themes.json b/forms/common-themes/src/main/resources/META-INF/keycloak-themes.json
new file mode 100644
index 0000000000..d9f09bd42f
--- /dev/null
+++ b/forms/common-themes/src/main/resources/META-INF/keycloak-themes.json
@@ -0,0 +1,12 @@
+{
+ "themes": [{
+ "name" : "base",
+ "types": [ "admin", "account", "login" ]
+ }, {
+ "name" : "patternfly",
+ "types": [ "admin", "account", "login" ]
+ }, {
+ "name" : "keycloak",
+ "types": [ "admin", "account", "login", "common", "email", "welcome" ]
+ }]
+}
\ No newline at end of file
diff --git a/forms/common-themes/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory b/forms/common-themes/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory
index c1b32dce49..ae680da049 100644
--- a/forms/common-themes/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory
+++ b/forms/common-themes/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory
@@ -1,2 +1,2 @@
-org.keycloak.theme.DefaultKeycloakThemeProviderFactory
+org.keycloak.theme.JarThemeProviderFactory
org.keycloak.theme.FolderThemeProviderFactory
\ No newline at end of file
diff --git a/integration/wildfly-extensions/pom.xml b/integration/wildfly-extensions/pom.xml
index e627d32897..4e19872463 100755
--- a/integration/wildfly-extensions/pom.xml
+++ b/integration/wildfly-extensions/pom.xml
@@ -41,6 +41,18 @@
${project.version}
provided
+
+ org.keycloak
+ keycloak-forms-common-freemarker
+ ${project.version}
+ provided
+
+
+ org.keycloak
+ keycloak-forms-common-themes
+ ${project.version}
+ provided
+
org.keycloak
keycloak-services
diff --git a/integration/wildfly-extensions/src/main/java/org/keycloak/provider/wildfly/ModuleThemeProviderFactory.java b/integration/wildfly-extensions/src/main/java/org/keycloak/provider/wildfly/ModuleThemeProviderFactory.java
new file mode 100644
index 0000000000..231ff0715a
--- /dev/null
+++ b/integration/wildfly-extensions/src/main/java/org/keycloak/provider/wildfly/ModuleThemeProviderFactory.java
@@ -0,0 +1,35 @@
+package org.keycloak.provider.wildfly;
+
+import org.jboss.modules.Module;
+import org.jboss.modules.ModuleClassLoader;
+import org.jboss.modules.ModuleIdentifier;
+import org.keycloak.Config;
+import org.keycloak.theme.JarThemeProviderFactory;
+
+/**
+ * @author Stian Thorgersen
+ */
+public class ModuleThemeProviderFactory extends JarThemeProviderFactory {
+
+ @Override
+ public void init(Config.Scope config) {
+ String[] modules = config.getArray("modules");
+ if (modules != null) {
+ try {
+ for (String moduleSpec : modules) {
+ Module module = Module.getContextModuleLoader().loadModule(ModuleIdentifier.fromString(moduleSpec));
+ ModuleClassLoader classLoader = module.getClassLoader();
+ loadThemes(classLoader, classLoader.getResourceAsStream(KEYCLOAK_THEMES_JSON));
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to load themes", e);
+ }
+ }
+ }
+
+ @Override
+ public String getId() {
+ return "module";
+ }
+
+}
diff --git a/integration/wildfly-extensions/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory b/integration/wildfly-extensions/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory
new file mode 100644
index 0000000000..c5515a67a3
--- /dev/null
+++ b/integration/wildfly-extensions/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory
@@ -0,0 +1 @@
+org.keycloak.provider.wildfly.ModuleThemeProviderFactory
\ No newline at end of file
diff --git a/project-integrations/aerogear-ups/auth-server/src/main/java/org/aerogear/ups/security/AerogearThemeProvider.java b/project-integrations/aerogear-ups/auth-server/src/main/java/org/aerogear/ups/security/AerogearThemeProvider.java
deleted file mode 100755
index 43aa2ebacd..0000000000
--- a/project-integrations/aerogear-ups/auth-server/src/main/java/org/aerogear/ups/security/AerogearThemeProvider.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.aerogear.ups.security;
-
-import org.keycloak.freemarker.Theme;
-import org.keycloak.freemarker.ThemeProvider;
-import org.keycloak.theme.ClassLoaderTheme;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Stian Thorgersen
- */
-public class AerogearThemeProvider implements ThemeProvider {
-
- public static final String AEROGEAR = "aerogear";
-
- private static Set ACCOUNT_THEMES = new HashSet();
- private static Set LOGIN_THEMES = new HashSet();
- private static Set ADMIN_THEMES = new HashSet();
-
- static {
- Collections.addAll(ACCOUNT_THEMES, AEROGEAR);
- Collections.addAll(LOGIN_THEMES, AEROGEAR);
- Collections.addAll(ADMIN_THEMES, AEROGEAR);
- }
-
- @Override
- public int getProviderPriority() {
- return 0;
- }
-
- @Override
- public Theme getTheme(String name, Theme.Type type) throws IOException {
- if (hasTheme(name, type)) {
- return new ClassLoaderTheme(name, type, getClass().getClassLoader());
- } else {
- return null;
- }
- }
-
- @Override
- public Set nameSet(Theme.Type type) {
- switch (type) {
- case LOGIN:
- return LOGIN_THEMES;
- case ACCOUNT:
- return ACCOUNT_THEMES;
- case ADMIN:
- return ADMIN_THEMES;
- default:
- return Collections.emptySet();
- }
- }
-
- @Override
- public boolean hasTheme(String name, Theme.Type type) {
- return nameSet(type).contains(name);
- }
-
- @Override
- public void close() {
- }
-
-}
diff --git a/project-integrations/aerogear-ups/auth-server/src/main/java/org/aerogear/ups/security/AerogearThemeProviderFactory.java b/project-integrations/aerogear-ups/auth-server/src/main/java/org/aerogear/ups/security/AerogearThemeProviderFactory.java
deleted file mode 100755
index f2a124bb95..0000000000
--- a/project-integrations/aerogear-ups/auth-server/src/main/java/org/aerogear/ups/security/AerogearThemeProviderFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.aerogear.ups.security;
-
-import org.keycloak.Config;
-import org.keycloak.freemarker.ThemeProvider;
-import org.keycloak.freemarker.ThemeProviderFactory;
-import org.keycloak.models.KeycloakSession;
-import org.keycloak.models.KeycloakSessionFactory;
-
-/**
- * @author Bill Burke
- * @version $Revision: 1 $
- */
-public class AerogearThemeProviderFactory implements ThemeProviderFactory {
- protected AerogearThemeProvider theme;
-
- @Override
- public ThemeProvider create(KeycloakSession session) {
- return theme;
- }
-
- @Override
- public void init(Config.Scope config) {
- theme = new AerogearThemeProvider();
- }
-
- @Override
- public void postInit(KeycloakSessionFactory factory) {
-
- }
-
- @Override
- public void close() {
-
- }
-
- @Override
- public String getId() {
- return "aerogear";
- }
-}
diff --git a/project-integrations/aerogear-ups/auth-server/src/main/resources/META-INF/keycloak-themes.json b/project-integrations/aerogear-ups/auth-server/src/main/resources/META-INF/keycloak-themes.json
new file mode 100644
index 0000000000..09db937822
--- /dev/null
+++ b/project-integrations/aerogear-ups/auth-server/src/main/resources/META-INF/keycloak-themes.json
@@ -0,0 +1,6 @@
+{
+ "themes": [{
+ "name" : "aerogear",
+ "types": [ "admin", "account", "login" ]
+ }]
+}
\ No newline at end of file
diff --git a/project-integrations/aerogear-ups/auth-server/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory b/project-integrations/aerogear-ups/auth-server/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory
deleted file mode 100755
index 3ea19ba020..0000000000
--- a/project-integrations/aerogear-ups/auth-server/src/main/resources/META-INF/services/org.keycloak.freemarker.ThemeProviderFactory
+++ /dev/null
@@ -1 +0,0 @@
-org.aerogear.ups.security.AerogearThemeProviderFactory
\ No newline at end of file