How to convert a jboss-ejb-client.properties to wildfly-config in JBoss EAP 7.1 for a standalone ejb client application

Solution Unverified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7.1

Issue

  • How to convert a jboss-ejb-client.properties to wildfly-config in JBoss EAP 7.1 for a standalone ejb client application

Resolution

endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=node1,node2

remote.connection.node1.host=jboss-host1
remote.connection.node1.port=8080
remote.connection.node1.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.node1.username=ejbuser1
remote.connection.node1.password=ejbpass1!

remote.connection.node2.host=jboss-host2
remote.connection.node2.port=8080
remote.connection.node2.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.node2.username=ejbuser2
remote.connection.node2.password=ejbpass2!

This jboss-ejb-client.properties above when changed to wildfly-config.xml would look like this:

<configuration>
    <authentication-client xmlns="urn:elytron:1.0">
        <authentication-rules>
            <rule use-configuration="default"><match-host name="jboss-host1"/></rule>
            <rule use-configuration="default2"><match-host name="jboss-host2"/></rule>
        </authentication-rules>
        <authentication-configurations>
            <configuration name="default">
                <sasl-mechanism-selector selector="DIGEST-MD5"/>
                <set-user-name name="ejbuser1"/>
                <credentials>
                    <clear-password password="ejbpass1!"/>
                </credentials>
            </configuration>
            <configuration name="default2">
                <sasl-mechanism-selector selector="DIGEST-MD5"/>
                <set-user-name name="ejbuser2"/>
                <credentials>
                    <clear-password password="ejbpass2!"/>
                </credentials>
            </configuration>
        </authentication-configurations>
    </authentication-client>

    <jboss-ejb-client xmlns="urn:jboss:wildfly-client-ejb:3.0">
        <connections>
            <connection uri="remote+http://jboss-host1:8080" />
            <connection uri="remote+http://jboss-host2:8080" />
        </connections>
    </jboss-ejb-client>
</configuration>

If All connections use the same username and password, the configuration can be simplified to this:

<configuration>
    <authentication-client xmlns="urn:elytron:1.0">
        <authentication-rules>
            <rule use-configuration="default"/>              
        </authentication-rules>
        <authentication-configurations>
            <configuration name="default">
                <sasl-mechanism-selector selector="DIGEST-MD5"/>
                <set-user-name name="ejbuser"/>
                <credentials>
                    <clear-password password="ejbpass!"/>
                </credentials>
            </configuration>
        </authentication-configurations>
    </authentication-client>
    <jboss-ejb-client xmlns="urn:jboss:wildfly-client-ejb:3.0">
        <connections>
            <connection uri="remote+http://jboss-host1:8080" />
            <connection uri="remote+http://jboss-host2:8080" />
        </connections>
    </jboss-ejb-client>
</configuration>

If there is more than one JBoss instance running on the same host but on a different port use match-port to specify the configuration to use

        <authentication-rules>
            <rule use-configuration="default"><match-port number="8080"/></rule>
            <rule use-configuration="default2"><match-port number="8180"/></rule>
        </authentication-rules>

See the JBoss EAP 7.1 Development Guide Documentation on Configuring Clients for more configuration options

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.