Skip to content

Commit

Permalink
[resolves wildfly-extras#182] Use management realm for hawtio authent…
Browse files Browse the repository at this point in the history
…ication
  • Loading branch information
Thomas Diesler committed Dec 18, 2014
1 parent 84c83b3 commit 169b3d6
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 14 deletions.
3 changes: 0 additions & 3 deletions docker/etc/context/entrypoint.sh
Expand Up @@ -18,9 +18,6 @@ then
${JBOSS_HOME}/bin/add-user.sh --silent -e -u ${WILDFLY_MANAGEMENT_USER} -p ${WILDFLY_MANAGEMENT_PASSWORD}
sed -i "s/@WILDFLY_MANAGEMENT_USER@/${WILDFLY_MANAGEMENT_USER}/" ${JBOSS_HOME}/domain/configuration/host-camel-slave.xml
sed -i "s/@WILDFLY_MANAGEMENT_PASSWORD@/`echo ${WILDFLY_MANAGEMENT_PASSWORD} | base64`/" ${JBOSS_HOME}/domain/configuration/host-camel-slave.xml

# [FIXME #182] Use management realm for hawtio authentication
${JBOSS_HOME}/bin/add-user.sh --silent -e -a -u ${WILDFLY_MANAGEMENT_USER} -p ${WILDFLY_MANAGEMENT_PASSWORD}
fi

if [[ ! -z "${WILDFLY_APPLICATION_USER}" ]] && [[ ! -z "${WILDFLY_APPLICATION_PASSWORD}" ]]
Expand Down
2 changes: 1 addition & 1 deletion itests/docker/domain/pom.xml
Expand Up @@ -148,7 +148,7 @@
<configuration>
<target>
<!-- [FIXME #175] Deployment fails with missing/unavailable dependencies -->
<sleep seconds="2"/>
<sleep seconds="5"/>

<echo>=========================================================================</echo>
<echo>docker run --rm -ti -p 9990:9990 -e WILDFLY_MANAGEMENT_USER=${wildfly.mgmt.username} -e WILDFLY_MANAGEMENT_PASSWORD=${wildfly.mgmt.password} --name=${docker.alias.master} ${docker.image.name} ${docker.cmd.master}</echo>
Expand Down
5 changes: 5 additions & 0 deletions patch/etc/hawtio/jboss-web.xml
@@ -0,0 +1,5 @@
<jboss-web>
<security-domain>hawtio-domain</security-domain>
<context-root>/hawtio</context-root>
</jboss-web>

4 changes: 0 additions & 4 deletions patch/etc/wildfly/domain/configuration/domain-camel.xml
Expand Up @@ -34,10 +34,6 @@
<system-properties>
<!-- IPv4 is not required, but setting this helps avoid unintended use of IPv6 -->
<property name="java.net.preferIPv4Stack" value="true"/>
<!-- Hawt.io Security -->
<property name="hawtio.authenticationEnabled" value="true" />
<property name="hawtio.realm" value="jboss-web-policy" />
<property name="hawtio.role" value="admin" />
</system-properties>
<management>
<access-control provider="simple">
Expand Down
Expand Up @@ -52,7 +52,7 @@
<system-properties>
<!-- Hawt.io Security -->
<property name="hawtio.authenticationEnabled" value="true" />
<property name="hawtio.realm" value="jboss-web-policy" />
<property name="hawtio.realm" value="hawtio-domain" />
<property name="hawtio.role" value="admin" />
</system-properties>

Expand Down Expand Up @@ -438,6 +438,13 @@
</login-module>
</authentication>
</security-domain>
<security-domain name="hawtio-domain" cache-type="default">
<authentication>
<login-module code="RealmDirect" flag="required">
<module-option name="realm" value="ManagementRealm"/>
</login-module>
</authentication>
</security-domain>
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:transactions:2.0">
Expand Down
6 changes: 5 additions & 1 deletion patch/scripts/antrun-wildfly-patch.xml
Expand Up @@ -61,7 +61,11 @@
</copy>

<!-- Hawt.io -->
<copy file="${deploy.artifacts.lib}/hawtio-jboss-${version.hawtio}.war" tofile="${wildfly.patch.dir}/standalone/deployments/hawtio.war"/>
<mkdir dir="${deploy.artifacts.dir}/hawtio"/>
<unzip src="${deploy.artifacts.lib}/hawtio-jboss-${version.hawtio}.war" dest="${deploy.artifacts.dir}/hawtio"/>
<copy file="${etc.dir}/hawtio/jboss-web.xml" todir="${deploy.artifacts.dir}/hawtio/WEB-INF"/>
<zip basedir="${deploy.artifacts.dir}/hawtio" destfile="${deploy.artifacts.dir}/hawtio-${version.hawtio}.war"/>
<copy file="${deploy.artifacts.dir}/hawtio-${version.hawtio}.war" tofile="${wildfly.patch.dir}/standalone/deployments/hawtio-${version.hawtio}.war"/>

<!-- Zip the wildfly patch -->
<!-- zip destfile="${output.dir}/${project.artifactId}-${project.version}.zip" basedir="${wildfly.patch.dir}"/-->
Expand Down
Expand Up @@ -44,15 +44,16 @@ public final class CamelDependenciesProcessor implements DeploymentUnitProcessor
private static final String WILDFLY_CAMEL = "org.wildfly.extension.camel";

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {

DeploymentUnit unit = phaseContext.getDeploymentUnit();
ModuleLoader moduleLoader = unit.getAttachment(Attachments.SERVICE_MODULE_LOADER);
ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION);

// no camel module dependencies for hawtio
// No camel module dependencies for hawtio
String runtimeName = unit.getName();
if ("hawtio.war".equals(runtimeName))
if (runtimeName.startsWith("hawtio") && runtimeName.endsWith(".war"))
return;

ModuleLoader moduleLoader = unit.getAttachment(Attachments.SERVICE_MODULE_LOADER);
ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION);
moduleSpec.addUserDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(GRAVIA), false, false, false, false));
moduleSpec.addUserDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(APACHE_CAMEL), false, false, false, false));
moduleSpec.addUserDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(WILDFLY_CAMEL), false, false, false, false));
Expand Down

0 comments on commit 169b3d6

Please sign in to comment.