From 54ee055bd86acd9727f20ebd5d83da63f3aff57b Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Tue, 25 Apr 2017 09:21:15 +0200 Subject: [PATCH] KEYCLOAK-4671 Add server-private-spi to dependency deployer --- .../keycloak/storage/ldap/mappers/LDAPStorageMapperSpi.java | 2 +- .../keycloak/connections/jpa/entityprovider/JpaEntitySpi.java | 2 +- .../org/keycloak/authentication/ClientAuthenticatorSpi.java | 2 +- .../main/java/org/keycloak/authentication/FormActionSpi.java | 2 +- .../org/keycloak/authentication/FormAuthenticatorSpi.java | 2 +- .../java/org/keycloak/authentication/RequiredActionSpi.java | 2 +- .../org/keycloak/broker/provider/IdentityProviderSpi.java | 2 +- .../java/org/keycloak/broker/social/SocialProviderSpi.java | 2 +- .../src/main/java/org/keycloak/credential/CredentialSpi.java | 2 +- .../java/org/keycloak/credential/hash/PasswordHashSpi.java | 2 +- .../src/main/java/org/keycloak/events/EventListenerSpi.java | 2 +- .../src/main/java/org/keycloak/policy/PasswordPolicySpi.java | 2 +- .../org/keycloak/services/DefaultKeycloakSessionFactory.java | 3 ++- .../services/clientregistration/ClientRegistrationSpi.java | 2 +- .../server/extension/KeycloakProviderDependencyProcessor.java | 2 ++ .../server/extension/KeycloakProviderDeploymentProcessor.java | 4 ++-- 16 files changed, 19 insertions(+), 16 deletions(-) diff --git a/federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/LDAPStorageMapperSpi.java b/federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/LDAPStorageMapperSpi.java index c7b8185dbf..54fe747fd5 100644 --- a/federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/LDAPStorageMapperSpi.java +++ b/federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/LDAPStorageMapperSpi.java @@ -30,7 +30,7 @@ public class LDAPStorageMapperSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/entityprovider/JpaEntitySpi.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/entityprovider/JpaEntitySpi.java index d89389fc48..4adadb6a62 100644 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/entityprovider/JpaEntitySpi.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/entityprovider/JpaEntitySpi.java @@ -30,7 +30,7 @@ public class JpaEntitySpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/authentication/ClientAuthenticatorSpi.java b/server-spi-private/src/main/java/org/keycloak/authentication/ClientAuthenticatorSpi.java index d8e6131ce8..e018d97cb4 100644 --- a/server-spi-private/src/main/java/org/keycloak/authentication/ClientAuthenticatorSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/authentication/ClientAuthenticatorSpi.java @@ -28,7 +28,7 @@ public class ClientAuthenticatorSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/authentication/FormActionSpi.java b/server-spi-private/src/main/java/org/keycloak/authentication/FormActionSpi.java index 94fc21dfaa..1c1a46f320 100755 --- a/server-spi-private/src/main/java/org/keycloak/authentication/FormActionSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/authentication/FormActionSpi.java @@ -28,7 +28,7 @@ public class FormActionSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/authentication/FormAuthenticatorSpi.java b/server-spi-private/src/main/java/org/keycloak/authentication/FormAuthenticatorSpi.java index 296f09771f..9ceac87481 100755 --- a/server-spi-private/src/main/java/org/keycloak/authentication/FormAuthenticatorSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/authentication/FormAuthenticatorSpi.java @@ -28,7 +28,7 @@ public class FormAuthenticatorSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/authentication/RequiredActionSpi.java b/server-spi-private/src/main/java/org/keycloak/authentication/RequiredActionSpi.java index 537227dce7..7e03572e92 100755 --- a/server-spi-private/src/main/java/org/keycloak/authentication/RequiredActionSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/authentication/RequiredActionSpi.java @@ -28,7 +28,7 @@ public class RequiredActionSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/broker/provider/IdentityProviderSpi.java b/server-spi-private/src/main/java/org/keycloak/broker/provider/IdentityProviderSpi.java index 85fdcce49b..8c32a86c9f 100644 --- a/server-spi-private/src/main/java/org/keycloak/broker/provider/IdentityProviderSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/broker/provider/IdentityProviderSpi.java @@ -29,7 +29,7 @@ public class IdentityProviderSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/broker/social/SocialProviderSpi.java b/server-spi-private/src/main/java/org/keycloak/broker/social/SocialProviderSpi.java index 805aa7be39..54a246d666 100755 --- a/server-spi-private/src/main/java/org/keycloak/broker/social/SocialProviderSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/broker/social/SocialProviderSpi.java @@ -29,7 +29,7 @@ public class SocialProviderSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/credential/CredentialSpi.java b/server-spi-private/src/main/java/org/keycloak/credential/CredentialSpi.java index c6277504cd..beeac96686 100644 --- a/server-spi-private/src/main/java/org/keycloak/credential/CredentialSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/credential/CredentialSpi.java @@ -28,7 +28,7 @@ public class CredentialSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/credential/hash/PasswordHashSpi.java b/server-spi-private/src/main/java/org/keycloak/credential/hash/PasswordHashSpi.java index bdee135d6f..1cf47580fe 100644 --- a/server-spi-private/src/main/java/org/keycloak/credential/hash/PasswordHashSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/credential/hash/PasswordHashSpi.java @@ -28,7 +28,7 @@ public class PasswordHashSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/events/EventListenerSpi.java b/server-spi-private/src/main/java/org/keycloak/events/EventListenerSpi.java index 9b125f0069..ddcce4d3c9 100644 --- a/server-spi-private/src/main/java/org/keycloak/events/EventListenerSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/events/EventListenerSpi.java @@ -28,7 +28,7 @@ public class EventListenerSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/server-spi-private/src/main/java/org/keycloak/policy/PasswordPolicySpi.java b/server-spi-private/src/main/java/org/keycloak/policy/PasswordPolicySpi.java index 97ad19a769..201e96e6bf 100644 --- a/server-spi-private/src/main/java/org/keycloak/policy/PasswordPolicySpi.java +++ b/server-spi-private/src/main/java/org/keycloak/policy/PasswordPolicySpi.java @@ -28,7 +28,7 @@ public class PasswordPolicySpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/services/src/main/java/org/keycloak/services/DefaultKeycloakSessionFactory.java b/services/src/main/java/org/keycloak/services/DefaultKeycloakSessionFactory.java index bd28e208bf..0134229fd2 100755 --- a/services/src/main/java/org/keycloak/services/DefaultKeycloakSessionFactory.java +++ b/services/src/main/java/org/keycloak/services/DefaultKeycloakSessionFactory.java @@ -359,7 +359,8 @@ public class DefaultKeycloakSessionFactory implements KeycloakSessionFactory, Pr } private boolean isInternal(ProviderFactory factory) { - return factory.getClass().getPackage().getName().startsWith("org.keycloak"); + String packageName = factory.getClass().getPackage().getName(); + return packageName.startsWith("org.keycloak") && !packageName.startsWith("org.keycloak.examples"); } /** diff --git a/services/src/main/java/org/keycloak/services/clientregistration/ClientRegistrationSpi.java b/services/src/main/java/org/keycloak/services/clientregistration/ClientRegistrationSpi.java index 50a0699385..5086be9c10 100644 --- a/services/src/main/java/org/keycloak/services/clientregistration/ClientRegistrationSpi.java +++ b/services/src/main/java/org/keycloak/services/clientregistration/ClientRegistrationSpi.java @@ -27,7 +27,7 @@ import org.keycloak.provider.Spi; public class ClientRegistrationSpi implements Spi { @Override public boolean isInternal() { - return false; + return true; } @Override diff --git a/wildfly/server-subsystem/src/main/java/org/keycloak/subsystem/server/extension/KeycloakProviderDependencyProcessor.java b/wildfly/server-subsystem/src/main/java/org/keycloak/subsystem/server/extension/KeycloakProviderDependencyProcessor.java index 5a5936f9a0..7def4d1345 100644 --- a/wildfly/server-subsystem/src/main/java/org/keycloak/subsystem/server/extension/KeycloakProviderDependencyProcessor.java +++ b/wildfly/server-subsystem/src/main/java/org/keycloak/subsystem/server/extension/KeycloakProviderDependencyProcessor.java @@ -42,6 +42,7 @@ public class KeycloakProviderDependencyProcessor implements DeploymentUnitProces private static final ModuleIdentifier KEYCLOAK_COMMON = ModuleIdentifier.create("org.keycloak.keycloak-common"); private static final ModuleIdentifier KEYCLOAK_CORE = ModuleIdentifier.create("org.keycloak.keycloak-core"); private static final ModuleIdentifier KEYCLOAK_SERVER_SPI = ModuleIdentifier.create("org.keycloak.keycloak-server-spi"); + private static final ModuleIdentifier KEYCLOAK_SERVER_SPI_PRIVATE = ModuleIdentifier.create("org.keycloak.keycloak-server-spi-private"); private static final ModuleIdentifier KEYCLOAK_JPA = ModuleIdentifier.create("org.keycloak.keycloak-model-jpa"); private static final ModuleIdentifier JAXRS = ModuleIdentifier.create("javax.ws.rs.api"); private static final ModuleIdentifier RESTEASY = ModuleIdentifier.create("org.jboss.resteasy.resteasy-jaxrs"); @@ -66,6 +67,7 @@ public class KeycloakProviderDependencyProcessor implements DeploymentUnitProces moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false)); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE, false, false, false, false)); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_SERVER_SPI, false, false, false, false)); + moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_SERVER_SPI_PRIVATE, false, false, false, false)); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAXRS, false, false, false, false)); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, RESTEASY, false, false, false, false)); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, APACHE, false, false, false, false)); diff --git a/wildfly/server-subsystem/src/main/java/org/keycloak/subsystem/server/extension/KeycloakProviderDeploymentProcessor.java b/wildfly/server-subsystem/src/main/java/org/keycloak/subsystem/server/extension/KeycloakProviderDeploymentProcessor.java index 97dd52a583..fcd1b463d7 100644 --- a/wildfly/server-subsystem/src/main/java/org/keycloak/subsystem/server/extension/KeycloakProviderDeploymentProcessor.java +++ b/wildfly/server-subsystem/src/main/java/org/keycloak/subsystem/server/extension/KeycloakProviderDeploymentProcessor.java @@ -48,7 +48,7 @@ public class KeycloakProviderDeploymentProcessor implements DeploymentUnitProces if (!KeycloakProviderDependencyProcessor.isKeycloakProviderDeployment(deploymentUnit)) return; - logger.infof("Deploying Keycloak provider: {0}", deploymentUnit.getName()); + logger.infov("Deploying Keycloak provider: {0}", deploymentUnit.getName()); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); ProviderManager pm = new ProviderManager(module.getClassLoader()); ProviderManagerRegistry.SINGLETON.deploy(pm); @@ -66,7 +66,7 @@ public class KeycloakProviderDeploymentProcessor implements DeploymentUnitProces public void undeploy(DeploymentUnit context) { ProviderManager pm = context.getAttachment(ATTACHMENT_KEY); if (pm != null) { - logger.infof("Undeploying Keycloak provider: {0}", context.getName()); + logger.infov("Undeploying Keycloak provider: {0}", context.getName()); ProviderManagerRegistry.SINGLETON.undeploy(pm); context.removeAttachment(ATTACHMENT_KEY); }