Fix embedded theme-resources lookup in Keycloak.X
Previously lookups for embedded theme-resources did not work for Keycloak.X because of a missing `ClasspathThemeResourceProvider` registration. This PR ensures that a `ClasspathThemeResourceProvider` is registered in Keycloak.X based deployments. Added empty constructors to ClasspathThemeResourceProvider to enable dynamic instantiation by Quarkus. Fixes #9653
This commit is contained in:
parent
510c482572
commit
438fc2865f
3 changed files with 24 additions and 1 deletions
|
@ -421,7 +421,14 @@ class KeycloakProcessor {
|
||||||
Map<String, ProviderFactory> preConfiguredProviders) {
|
Map<String, ProviderFactory> preConfiguredProviders) {
|
||||||
Config.init(new MicroProfileConfigProvider());
|
Config.init(new MicroProfileConfigProvider());
|
||||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||||
ProviderManager pm = new ProviderManager(KeycloakDeploymentInfo.create().services(), classLoader);
|
|
||||||
|
KeycloakDeploymentInfo keycloakDeploymentInfo = KeycloakDeploymentInfo.create()
|
||||||
|
.name("classpath")
|
||||||
|
.services()
|
||||||
|
// .themes() // handling of .jar based themes is already supported by Keycloak.x
|
||||||
|
.themeResources();
|
||||||
|
|
||||||
|
ProviderManager pm = new ProviderManager(keycloakDeploymentInfo, classLoader);
|
||||||
Map<Spi, Map<Class<? extends Provider>, Map<String, ProviderFactory>>> factories = new HashMap<>();
|
Map<Spi, Map<Class<? extends Provider>, Map<String, ProviderFactory>>> factories = new HashMap<>();
|
||||||
|
|
||||||
for (Spi spi : pm.loadSpis()) {
|
for (Spi spi : pm.loadSpis()) {
|
||||||
|
|
|
@ -37,6 +37,10 @@ public class KeycloakDeploymentInfo {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables discovery of services via {@link java.util.ServiceLoader}.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public KeycloakDeploymentInfo services() {
|
public KeycloakDeploymentInfo services() {
|
||||||
this.services = true;
|
this.services = true;
|
||||||
return this;
|
return this;
|
||||||
|
@ -46,6 +50,10 @@ public class KeycloakDeploymentInfo {
|
||||||
return themes;
|
return themes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables discovery embedded themes.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public KeycloakDeploymentInfo themes() {
|
public KeycloakDeploymentInfo themes() {
|
||||||
this.themes = true;
|
this.themes = true;
|
||||||
return this;
|
return this;
|
||||||
|
@ -55,6 +63,10 @@ public class KeycloakDeploymentInfo {
|
||||||
return themeResources;
|
return themeResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables discovery of embedded theme-resources.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public KeycloakDeploymentInfo themeResources() {
|
public KeycloakDeploymentInfo themeResources() {
|
||||||
themeResources = true;
|
themeResources = true;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -22,6 +22,10 @@ public class ClasspathThemeResourceProviderFactory implements ThemeResourceProvi
|
||||||
private final String id;
|
private final String id;
|
||||||
private final ClassLoader classLoader;
|
private final ClassLoader classLoader;
|
||||||
|
|
||||||
|
public ClasspathThemeResourceProviderFactory() {
|
||||||
|
this("classpath", Thread.currentThread().getContextClassLoader());
|
||||||
|
}
|
||||||
|
|
||||||
public ClasspathThemeResourceProviderFactory(String id, ClassLoader classLoader) {
|
public ClasspathThemeResourceProviderFactory(String id, ClassLoader classLoader) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.classLoader = classLoader;
|
this.classLoader = classLoader;
|
||||||
|
|
Loading…
Reference in a new issue