KEYCLOAK-3716 Unable to start Keycloak on wildfly

This commit is contained in:
mposolda 2016-10-17 12:22:33 +02:00
parent acdc33b2fa
commit 5732b2c58f
5 changed files with 19 additions and 5 deletions

View file

@ -73,6 +73,8 @@ public interface KeycloakSession {
<T extends Provider> Set<T> getAllProviders(Class<T> clazz);
Class<? extends Provider> getProviderClass(String providerClassName);
Object getAttribute(String attribute);
Object removeAttribute(String attribute);
void setAttribute(String name, Object value);

View file

@ -47,10 +47,8 @@ public class ComponentUtil {
}
public static ComponentFactory getComponentFactory(KeycloakSession session, ComponentModel component) {
Class<? extends Provider> provider;
try {
provider = (Class<? extends Provider>) Class.forName(component.getProviderType());
} catch (ClassNotFoundException e) {
Class<? extends Provider> provider = session.getProviderClass(component.getProviderType());
if (provider == null) {
throw new RuntimeException("Invalid provider type '" + component.getProviderType() + "'");
}

View file

@ -227,6 +227,11 @@ public class DefaultKeycloakSession implements KeycloakSession {
return providers;
}
@Override
public Class<? extends Provider> getProviderClass(String providerClassName) {
return factory.getProviderClass(providerClassName);
}
@Override
public RealmProvider realms() {
if (model == null) {

View file

@ -339,6 +339,15 @@ public class DefaultKeycloakSessionFactory implements KeycloakSessionFactory, Pr
return ids;
}
Class<? extends Provider> getProviderClass(String providerClassName) {
for (Class<? extends Provider> clazz : factoriesMap.keySet()) {
if (clazz.getName().equals(providerClassName)) {
return clazz;
}
}
return null;
}
public void close() {
ProviderManagerRegistry.SINGLETON.setDeployer(null);
for (Map<String, ProviderFactory> factories : factoriesMap.values()) {

View file

@ -63,7 +63,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
public class OIDCClientRegistrationPoliciesTest extends AbstractClientRegistrationTest {
public class ClientRegistrationPoliciesTest extends AbstractClientRegistrationTest {
private static final String PRIVATE_KEY = "MIICXAIBAAKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQABAoGAfmO8gVhyBxdqlxmIuglbz8bcjQbhXJLR2EoS8ngTXmN1bo2L90M0mUKSdc7qF10LgETBzqL8jYlQIbt+e6TH8fcEpKCjUlyq0Mf/vVbfZSNaVycY13nTzo27iPyWQHK5NLuJzn1xvxxrUeXI6A2WFpGEBLbHjwpx5WQG9A+2scECQQDvdn9NE75HPTVPxBqsEd2z10TKkl9CZxu10Qby3iQQmWLEJ9LNmy3acvKrE3gMiYNWb6xHPKiIqOR1as7L24aTAkEAtyvQOlCvr5kAjVqrEKXalj0Tzewjweuxc0pskvArTI2Oo070h65GpoIKLc9jf+UA69cRtquwP93aZKtW06U8dQJAF2Y44ks/mK5+eyDqik3koCI08qaC8HYq2wVl7G2QkJ6sbAaILtcvD92ToOvyGyeE0flvmDZxMYlvaZnaQ0lcSQJBAKZU6umJi3/xeEbkJqMfeLclD27XGEFoPeNrmdx0q10Azp4NfJAY+Z8KRyQCR2BEG+oNitBOZ+YXF9KCpH3cdmECQHEigJhYg+ykOvr1aiZUMFT72HU0jnmQe2FVekuG+LJUt2Tm7GtMjTFoGpf0JwrVuZN39fOYAlo+nTixgeW7X8Y=";
private static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB";