<!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;">
Authentication failed using DatabaseServerLoginModule
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/rmarini">Ricardo Marini</a> in <i>PicketBox Development</i> - <a href="https://community.jboss.org/message/784490#784490">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi all.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I'm trying to use the DatabaseServerLoginModule, but isn't working. I found many examples like this.<br/>What is wrong?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I've in my standalone.xml:</p><p>                ...<br/>                <security-domain name="TestSecurityDomain" 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="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required"><br/>                            <module-option name="dsJndiName" value="java:jboss/datasources/MysqlDS"/><br/>                            <module-option name="principalsQuery" value="select u_password from users where u_name=?"/><br/>                            <module-option name="rolesQuery" value="select u_profile_name, 'Roles' from user_profile where u_name=?"/><br/>                            <module-option name="password-stacking" value="useFirstPass"/><br/>                        </login-module><br/>                    </authentication><br/>                </security-domain><br/>                ...<br/>                <datasource jndi-name="java:jboss/datasources/MysqlDS" pool-name="MysqlDS" enabled="true" use-java-context="true"><br/>                    <connection-url>jdbc:mysql://localhost:3306/teste</connection-url><br/>                    <driver>mysql</driver><br/>                    <security><br/>                        <user-name>user_db</user-name><br/>                        <password>pass_db</password><br/>                    </security><br/>                    <statement><br/>                        <prepared-statement-cache-size>100</prepared-statement-cache-size><br/>                        <share-prepared-statements>true</share-prepared-statements><br/>                    </statement><br/>                </datasource><br/>                ...<br/>            <security-realm name="TestApplicationRealm"><br/>                <authentication><br/>                     <jaas name="TestSecurityDomain"/><br/>                </authentication><br/>            </security-realm><br/>        ...<br/>        <subsystem xmlns="urn:jboss:domain:remoting:1.1"><br/>            <connector name="remoting-connector" socket-binding="remoting" security-realm="TestApplicationRealm"/><br/>        </subsystem></p><p>  <br/>In the jboss-app.xml:<br/><security-domain>TestSecurityDomain</security-domain></p><p><br/>In the client side:</p><p>jboss-ejb-client.properties:<br/>endpoint.name=client-endpoint<br/>remote.connections=default<br/>remote.connection.default.host=localhost<br/>remote.connection.default.port=4447<br/>remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=true<br/>remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER<br/>remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false<br/>remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false</p><p><br/>lookup class:<br/>   Hashtable envTable = new Hashtable();<br/>   envTable.put(Context.URL_PKG_PREFIXES,<br/>     "org.jboss.ejb.client.naming");<br/>   envTable.put(Context.INITIAL_CONTEXT_FACTORY,<br/>     "org.jboss.naming.remote.client.InitialContextFactory");<br/>   envTable.put(Context.PROVIDER_URL, "remote://localhost:4447");<br/>   envTable.put(Context.SECURITY_PRINCIPAL, "rmarini");<br/>   envTable.put(Context.SECURITY_CREDENTIALS, "rmarini1");<br/>   envTable.put("jboss.naming.client.ejb.context", true);<br/>   Context context = new InitialContext(envTable);</p><p>   <br/>When I run the client, returns this exception:<br/>INFO: JBoss Remoting version 3.2.3.GA<br/>21/12/2012 10:57:57 org.jboss.remoting3.remote.RemoteConnection handleException<br/>ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed<br/>javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed]<br/> at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)<br/> at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121)<br/> at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)<br/> at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)<br/> at javax.naming.InitialContext.init(InitialContext.java:223)<br/> at javax.naming.InitialContext.<init>(InitialContext.java:197)<br/>    ...<br/>Caused by: java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed<br/> at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:87)<br/> at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:56)<br/> at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateCachedNamingStore(InitialContextFactory.java:166)<br/> at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:139)<br/> at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:104)<br/> ... 5 more<br/>Caused by: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed<br/> at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:365)<br/> at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:214)<br/> at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)<br/> at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)<br/> at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)<br/> at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)<br/> at org.xnio.nio.NioHandle.run(NioHandle.java:90)<br/> at org.xnio.nio.WorkerThread.run(WorkerThread.java:184)<br/> at ...asynchronous invocation...(Unknown Source)<br/> at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:270)<br/> at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251)<br/> at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349)<br/> at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:333)<br/> at org.jboss.naming.remote.client.EndpointCache$EndpointWrapper.connect(EndpointCache.java:105)<br/> at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:55)<br/> ... 8 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>In the server, no exception is displayed, even set org.jboss.security to TRACE.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I tried with Jboss 7.1 (picketbox-4.0.7.Final) and Jboss 7.2 Alpha (picketbox-4.0.14.Final).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I found AS7-1370 related with this topic. there is a form to work around this?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Ricardo.</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/784490#784490">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in PicketBox Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2088">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>