Merge pull request #895 from ssilvert/KEYCLOAK-880-props-in-subsys

KEYCLOAK-880 Fix use of ${..} props in subsystem XML
This commit is contained in:
Bill Burke 2014-12-17 16:08:12 -05:00
commit 519d051eb0
10 changed files with 14 additions and 13 deletions

View file

@ -40,7 +40,7 @@ public class CredentialAddHandler extends AbstractAddStepHandlerWithAttributes {
@Override @Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context); KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context);
ckService.addCredential(operation, model); ckService.addCredential(operation, context.resolveExpressions(model));
} }
} }

View file

@ -61,6 +61,6 @@ public final class RealmAddHandler extends AbstractAddStepHandler {
@Override @Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context); KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context);
ckService.addRealm(operation, model); ckService.addRealm(operation, context.resolveExpressions(model));
} }
} }

View file

@ -56,6 +56,6 @@ public final class SecureDeploymentAddHandler extends AbstractAddStepHandler {
@Override @Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context); KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context);
ckService.addSecureDeployment(operation, model); ckService.addSecureDeployment(operation, context.resolveExpressions(model));
} }
} }

View file

@ -41,7 +41,7 @@ public class CredentialAddHandler extends AbstractAddStepHandler {
@Override @Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context); KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context);
ckService.addCredential(operation, model); ckService.addCredential(operation, context.resolveExpressions(model));
} }
} }

View file

@ -35,15 +35,15 @@ import java.util.List;
/** /**
* Pass authentication data (keycloak.json) as a servlet context param so it can be read by the KeycloakServletExtension. * Pass authentication data (keycloak.json) as a servlet context param so it can be read by the KeycloakServletExtension.
* This is used for AS7/EAP6. * This is used for EAP6.
* *
* @author Stan Silvert ssilvert@redhat.com (C) 2014 Red Hat Inc. * @author Stan Silvert ssilvert@redhat.com (C) 2014 Red Hat Inc.
*/ */
// Note: Even though this class closely resembles the WildFly KeycloakAdapterConfigDeploymentProcessor // Note: Even though this class closely resembles the WildFly KeycloakAdapterConfigDeploymentProcessor
// it can not be easily refactored because the WarMetaData classes are of different types. // it can not be easily refactored because the WarMetaData classes are of different types.
public class KeycloakAdapterConfigDeploymentProcessorAS7 implements DeploymentUnitProcessor { public class KeycloakAdapterConfigDeploymentProcessorEAP6 implements DeploymentUnitProcessor {
protected Logger log = Logger.getLogger(KeycloakAdapterConfigDeploymentProcessorAS7.class); protected Logger log = Logger.getLogger(KeycloakAdapterConfigDeploymentProcessorEAP6.class);
@Override @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {

View file

@ -23,11 +23,11 @@ import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoader; import org.jboss.modules.ModuleLoader;
/** /**
* Adds platform-specific modules for AS7 * Adds platform-specific modules for EAP6
* *
* @author Stan Silvert ssilvert@redhat.com (C) 2014 Red Hat Inc. * @author Stan Silvert ssilvert@redhat.com (C) 2014 Red Hat Inc.
*/ */
public class KeycloakDependencyProcessorAS7 extends KeycloakDependencyProcessor { public class KeycloakDependencyProcessorEAP6 extends KeycloakDependencyProcessor {
private static final ModuleIdentifier KEYCLOAK_AS7_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-as7-adapter"); private static final ModuleIdentifier KEYCLOAK_AS7_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-as7-adapter");

View file

@ -70,7 +70,7 @@ class KeycloakSubsystemAdd extends AbstractBoottimeAddStepHandler {
if (Environment.isWildFly()) { if (Environment.isWildFly()) {
return new KeycloakDependencyProcessorWildFly(); return new KeycloakDependencyProcessorWildFly();
} else { } else {
return new KeycloakDependencyProcessorAS7(); return new KeycloakDependencyProcessorEAP6();
} }
} }
@ -78,7 +78,7 @@ class KeycloakSubsystemAdd extends AbstractBoottimeAddStepHandler {
if (Environment.isWildFly()) { if (Environment.isWildFly()) {
return new KeycloakAdapterConfigDeploymentProcessor(); return new KeycloakAdapterConfigDeploymentProcessor();
} else { } else {
return new KeycloakAdapterConfigDeploymentProcessorAS7(); return new KeycloakAdapterConfigDeploymentProcessorEAP6();
} }
} }

View file

@ -61,6 +61,6 @@ public final class RealmAddHandler extends AbstractAddStepHandler {
@Override @Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context); KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context);
ckService.addRealm(operation, model); ckService.addRealm(operation, context.resolveExpressions(model));
} }
} }

View file

@ -56,6 +56,6 @@ public final class SecureDeploymentAddHandler extends AbstractAddStepHandler {
@Override @Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context); KeycloakAdapterConfigService ckService = KeycloakAdapterConfigService.find(context);
ckService.addSecureDeployment(operation, model); ckService.addSecureDeployment(operation, context.resolveExpressions(model));
} }
} }

View file

@ -51,6 +51,7 @@ public final class AuthServerAddHandler extends AbstractAddStepHandler {
for (AttributeDefinition attr : AuthServerDefinition.ALL_ATTRIBUTES) { for (AttributeDefinition attr : AuthServerDefinition.ALL_ATTRIBUTES) {
attr.validateAndSet(operation, model); attr.validateAndSet(operation, model);
} }
model = context.resolveExpressions(model);
// returns early if on domain controller // returns early if on domain controller
if (!requiresRuntime(context)) return; if (!requiresRuntime(context)) return;