<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: IronJacamar Oracle Reauthentication support
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/peterfry">Peter Fry</a> in <i>IronJacamar Development</i> - <a href="https://community.jboss.org/message/833528#833528">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Is there a test case for this component. I am trying to support Oracle Proxy Authentication on EAP 6.0.1 but without any joy. My main stumbling block is the configuration of the security section of the datasource:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p align="left"> <span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">subsystem</span><span style="font-size: 10pt;"> </span><span style="color: #7f007f; font-size: 10pt;">xmlns</span><span style="font-size: 10pt;">=</span><em style="color: #2a00ff; font-size: 10pt;"><em style="color: #2a00ff; font-size: 10pt;">"urn:jboss:domain:datasources:1.1"</em></em><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;"> <span style="font-size: 2;"><p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">xa-datasource</span><span style="font-size: 10pt;"> </span><span style="color: #7f007f; font-size: 10pt;">jndi-name</span><span style="font-size: 10pt;">=</span><em style="color: #2a00ff; font-size: 10pt;"><em style="color: #2a00ff; font-size: 10pt;">"java:jboss/datasources/someDS"</em></em><span style="font-size: 10pt;"> </span><span style="color: #7f007f; font-size: 10pt;">pool-name</span><span style="font-size: 10pt;">=</span><em style="color: #2a00ff; font-size: 10pt;"><em style="color: #2a00ff; font-size: 10pt;">"java:jboss/datasources/someDS_Pool"</em></em><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;"> </span></p></p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">datasources</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;"> </span></span></p><p><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">xa-datasource-property</span><span style="font-size: 10pt;"> </span><span style="color: #7f007f; font-size: 10pt;">name</span><span style="font-size: 10pt;">=</span><em style="color: #2a00ff; font-size: 10pt;"><em style="color: #2a00ff; font-size: 10pt;">"URL"</em></em><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;"> jdbc:oracle:thin:@%DATABASE_HOST%:%DATABASE_PORT%:%DATABASE_SID%<span style="font-size: 2;"><p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">xa-pool</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">is-same-rm-override</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;">false</span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">is-same-rm-override</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">no-tx-separate-pools</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;">true</span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">no-tx-separate-pools</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">xa-pool</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">security</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><p align="left"><p align="left"><div align="left"><span style="color: #3f5fbf; font-size: 10pt;"><div align="left"><span style="color: #3f5fbf; font-size: 10pt;"><!--<user-name>USERNAME</user-name></span></div></span></div></p></p><span style="color: #3f5fbf; font-size: 10pt;"><p align="left"><password>PASSWORD</password></p><span style="color: #3f5fbf; font-size: 2;"><p align="left"><reauth-<span style="text-decoration: underline;">plugin</span> class-name="org.me.OracleReauthPlugin"/>--></p></span></span><p align="left"><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">security-domain</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;">demo</span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">security-domain</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span></p><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">security</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">validation</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">valid-connection-checker</span><span style="font-size: 10pt;"> </span><span style="color: #7f007f; font-size: 10pt;">class-name</span><span style="font-size: 10pt;">=</span><em style="color: #2a00ff; font-size: 10pt;"><em style="color: #2a00ff; font-size: 10pt;">"org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"</em></em><span style="color: #008080; font-size: 10pt;">/></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">stale-connection-checker</span><span style="font-size: 10pt;"> </span><span style="color: #7f007f; font-size: 10pt;">class-name</span><span style="font-size: 10pt;">=</span><em style="color: #2a00ff; font-size: 10pt;"><em style="color: #2a00ff; font-size: 10pt;">"org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"</em></em><span style="color: #008080; font-size: 10pt;">/></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">exception-sorter</span><span style="font-size: 10pt;"> </span><span style="color: #7f007f; font-size: 10pt;">class-name</span><span style="font-size: 10pt;">=</span><em style="color: #2a00ff; font-size: 10pt;"><em style="color: #2a00ff; font-size: 10pt;">"org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"</em></em><span style="color: #008080; font-size: 10pt;">/></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">validation</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">xa-datasource</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">drivers</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">driver</span><span style="font-size: 10pt;"> </span><span style="color: #7f007f; font-size: 10pt;">name</span><span style="font-size: 10pt;">=</span><em style="color: #2a00ff; font-size: 10pt;"><em style="color: #2a00ff; font-size: 10pt;">"oracle"</em></em><span style="font-size: 10pt;"> </span><span style="color: #7f007f; font-size: 10pt;">module</span><span style="font-size: 10pt;">=</span><em style="color: #2a00ff; font-size: 10pt;"><em style="color: #2a00ff; font-size: 10pt;">"com.oracle"</em></em><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">xa-datasource-class</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;">oracle.jdbc.xa.client.OracleXADataSource</span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">xa-datasource-class</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">driver</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">drivers</span><span style="color: #008080; font-size: 10pt;">></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">datasources</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">subsystem</span><span style="color: #008080; font-size: 10pt;">></span></span></p></span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">xa-datasource-property</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;"> <span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><span style="color: #008080; font-size: 10pt;"><</span><span style="color: #3f7f7f; font-size: 10pt;">driver</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 10pt;">oracle</span><span style="color: #008080; font-size: 10pt;"></</span><span style="color: #3f7f7f; font-size: 10pt;">driver</span><span style="color: #008080; font-size: 10pt;">></span><span style="font-size: 2;"> </span></span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have added a security domain</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><subsystem xmlns="urn:jboss:domain:security:1.2"><br/>        <security-domains><br/>                <security-domain name="other" cache-type="default"><br/>                    <authentication><br/>                        <login-module code="Remoting" flag="optional"><br/>                            <module-option name="password-stacking" value="useFirstPass"/><br/>                        </login-module><br/>                        <login-module code="RealmDirect" flag="required"><br/>                            <module-option name="password-stacking" value="useFirstPass"/><br/>                        </login-module><br/>                    </authentication><br/>                </security-domain><br/>                <security-domain name="jboss-web-policy" cache-type="default"><br/>                    <authorization><br/>                        <policy-module code="Delegating" flag="required"/><br/>                    </authorization><br/>                </security-domain><br/>                <security-domain name="jboss-ejb-policy" cache-type="default"><br/>                    <authorization><br/>                        <policy-module code="Delegating" flag="required"/><br/>                    </authorization><br/>                </security-domain><br/>                <security-domain name="brms" cache-type="default"><br/>                    <authentication><br/>                        <login-module code="UsersRoles" flag="required"><br/>                            <module-option name="usersProperties" value="${jboss.server.config.dir}/brms-users.properties"/><br/>                            <module-option name="rolesProperties" value="${jboss.server.config.dir}/brms-roles.properties"/><br/>                        </login-module><br/>                    </authentication><br/>                </security-domain><br/>                <!-- Introduced for demonstrating Oracle Proxy Authentication --><br/>    <security-domain name="demo" cache-type="default"> <br/>       <authentication><br/>          <login-module code="SimpleUsers" flag="sufficient"><br/>                <module-option name="username" value="USERNAME"/><br/>                <module-option name="password" value="PASSWORD"/><br/>          </login-module><br/>          <login-module code="UsersRoles" flag="sufficient"><br/>                <module-option name="usersProperties" value="${jboss.server.config.dir}/demo-users.properties"/><br/>                            <module-option name="rolesProperties" value="${jboss.server.config.dir}/demo-roles.properties"/><br/>          </login-module><br/>       </authentication><br/>    </security-domain>                <br/> </security-domains><br/></subsystem></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I'm then running a arquillian test</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import java.security.PrivilegedAction;<br/>import java.sql.SQLException;<br/>import java.util.logging.Level;<br/>import java.util.logging.Logger;</p><p>import javax.ejb.EJB;<br/>import javax.security.auth.Subject;<br/>import javax.security.auth.login.LoginContext;<br/>import javax.security.auth.login.LoginException;</p><p>import org.jboss.arquillian.container.test.api.Deployment;<br/>import org.jboss.arquillian.junit.Arquillian;<br/>import org.jboss.arquillian.secureejb.JBossLoginContextFactory;<br/>import org.jboss.arquillian.secureejb.demo.SecurityRoles;<br/>import org.jboss.shrinkwrap.api.ShrinkWrap;<br/>import org.jboss.shrinkwrap.api.asset.EmptyAsset;<br/>import org.jboss.shrinkwrap.api.spec.WebArchive;<br/>import org.junit.Test;<br/>import org.junit.runner.RunWith;</p><p>import org.me.TestEjb; </p><p>@RunWith(Arquillian.class)<br/>public class OracleReauthPluginTest {</p><p> private static final Logger logger = Logger.getLogger(OracleReauthPluginTest.class.getName());<br/> <br/>    @EJB<br/>    private TestEjb testEjb;</p><p>    @Deployment <br/>    public static WebArchive createTestArchive() {<br/>        WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war")<br/>                .addClasses(JBossLoginContextFactory.class, SecurityRoles.class, TestEjb.class)<br/>                .addAsWebInfResource("META-INF/ejb-jar.xml").addAsWebInfResource("META-INF/jboss-ejb3.xml")<br/>                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsResource("users.properties")<br/>                .addAsResource("roles.properties");<br/>        return webArchive;<br/>    }</p><p>    @Test<br/>    public void testAuthorisedSecureOperation() throws LoginException {<br/>        LoginContext loginContext = JBossLoginContextFactory.createLoginContext("user1", "password");<br/>        loginContext.login();<br/>        try {<br/>            Subject.doAs(loginContext.getSubject(), new PrivilegedAction<Void>() {</p><p>                @Override<br/>                public Void run() {<br/>                 try {<br/>     testEjb.performSecureOperation();<br/>   } catch (SQLException e) {<br/>     logger.log(Level.SEVERE, "EJB oepration failed", e);<br/>   }<br/>                    return null;<br/>                }</p><p>            });<br/>        } finally {<br/>            loginContext.logout();<br/>        }<br/>    }<br/>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>With the logon context being supplied by</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>package org.jboss.arquillian.secureejb;</p><p>import java.io.IOException;<br/>import java.util.HashMap;<br/>import java.util.Map;</p><p>import javax.resource.spi.security.PasswordCredential;<br/>import javax.security.auth.Subject;<br/>import javax.security.auth.callback.Callback;<br/>import javax.security.auth.callback.CallbackHandler;<br/>import javax.security.auth.callback.NameCallback;<br/>import javax.security.auth.callback.PasswordCallback;<br/>import javax.security.auth.callback.UnsupportedCallbackException;<br/>import javax.security.auth.login.AppConfigurationEntry;<br/>import javax.security.auth.login.Configuration;<br/>import javax.security.auth.login.LoginContext;<br/>import javax.security.auth.login.LoginException;</p><p>/**<br/> * Provides a <a class="" href="https://community.jboss.org/mailto:{@link">{@link</a> LoginContext} for use by unit tests. It is driven by users.properties and roles.properties files as<br/> * described in <a href="<a class="" href="https://community.jboss.org/wiki/UsersRolesLoginModule&quot;>UsersRolesLoginModule</a">https://community.jboss.org/wiki/UsersRolesLoginModule">UsersRolesLoginModule</a</a>><br/> */<br/>public class JBossLoginContextFactory {</p><p>    static class NamePasswordCallbackHandler implements CallbackHandler {<br/>        private final String username;<br/>        private final String password;</p><p>        private NamePasswordCallbackHandler(String username, String password) {<br/>            this.username = username;<br/>            this.password = password;<br/>        }</p><p>        public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {<br/>            for (Callback current : callbacks) {<br/>                if (current instanceof NameCallback) {<br/>                    ((NameCallback) current).setName(username);<br/>                } else if (current instanceof PasswordCallback) {<br/>                    ((PasswordCallback) current).setPassword(password.toCharArray());<br/>                } else {<br/>                    throw new UnsupportedCallbackException(current);<br/>                }<br/>            }<br/>        }<br/>    }</p><p>    static class JBossJaasConfiguration extends Configuration {<br/>        private final String configurationName;</p><p>        JBossJaasConfiguration(String configurationName) {<br/>            this.configurationName = configurationName;<br/>        }</p><p>        @Override<br/>        public AppConfigurationEntry[] getAppConfigurationEntry(String name) {<br/>            if (!configurationName.equals(name)) {<br/>                throw new IllegalArgumentException("Unexpected configuration name '" + name + "'");<br/>            }</p><p>            return new AppConfigurationEntry[] {</p><p>            createUsersRolesLoginModuleConfigEntry(),</p><p>            createClientLoginModuleConfigEntry(),</p><p>            };<br/>        }</p><p>        /**<br/>         * The <a class="" href="https://community.jboss.org/mailto:{@link">{@link</a> org.jboss.security.auth.spi.UsersRolesLoginModule} creates the association between users and<br/>         * roles.<br/>         * <br/>         * @return<br/>         */<br/>        private AppConfigurationEntry createUsersRolesLoginModuleConfigEntry() {<br/>            Map<String, String> options = new HashMap<String, String>();<br/>            return new AppConfigurationEntry("org.jboss.security.auth.spi.UsersRolesLoginModule",<br/>                    AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);<br/>        }</p><p>        /**<br/>         * The <a class="" href="https://community.jboss.org/mailto:{@link">{@link</a> org.jboss.security.ClientLoginModule} associates the user credentials with the<br/>         * <a class="" href="https://community.jboss.org/mailto:{@link">{@link</a> org.jboss.security.SecurityContext} where the JBoss security runtime can find it.<br/>         * <br/>         * @return<br/>         */<br/>        private AppConfigurationEntry createClientLoginModuleConfigEntry() {<br/>            Map<String, String> options = new HashMap<String, String>();<br/>            options.put("multi-threaded", "true");<br/>            options.put("restore-login-identity", "true");</p><p>            return new AppConfigurationEntry("org.jboss.security.ClientLoginModule",<br/>                    AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);<br/>        }<br/>    }</p><p>    /**<br/>     * Obtain a LoginContext configured for use with the ClientLoginModule.<br/>     * <br/>     * @return the configured LoginContext.<br/>     */<br/>    public static LoginContext createLoginContext(final String username, final String password) throws LoginException {<br/>        final String configurationName = "Arquillian Testing";</p><p>        CallbackHandler cbh = new JBossLoginContextFactory.NamePasswordCallbackHandler(username, password);<br/>        Configuration config = new JBossJaasConfiguration(configurationName);<br/>        Subject subject = new Subject();<br/>        PasswordCredential credential = new PasswordCredential(username,  password.toCharArray());<br/>        <br/>        subject.getPrivateCredentials().add(credential);<br/>        return new LoginContext(configurationName, subject, cbh, config);<br/>    }</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The problem I have is that in BaseWrapperManagedConnectionFactory.SubjectActions.run() the subject has no private credentials.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Is the approach I'm taking (in terms of setting up an integration test) correct? I am hacking around with this.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/833528#833528">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in IronJacamar Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2099">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>