<!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;">
    JBoss AS7: Security : Custom Login Modules
</h3>
<span style="margin-bottom: 10px;">
    new comment by <a href="https://community.jboss.org/people/alxt">Alexey Tomin</a> <a href="https://community.jboss.org/docs/DOC-17357#comment-10067">View all comments on this document</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>In 7.1.1 I try use custom module</p><p>1. in standalone-full.xml: </p><p>&lt;security-domain name="RolesLoginModule"&gt;</p><p>&#160; &lt;authentication&gt;</p><p>&#160;&#160;&#160;&#160; &lt;login-module code="ru.infosfera.common.auth.server_module.RolesLoginModule" flag="required"/&gt;</p><p>...</p><p>2. in my EAR in JAR add class ru.infosfera.common.auth.server_module.RolesLoginModule (implements LoginModule) and in class log all operations (initialize, login, commit, abort, logout).</p><p>3. in JAR add META-INF/jboss.xml with </p><p>&#160;&#160; &lt;jboss&gt;&lt;security-domain&gt;RolesLoginModule&lt;/security-domain&gt;&lt;/jboss&gt;</p><p>&#160;&#160; In EAR no files for jboss.</p><p>4. In client add parameters fomr InitialContext </p><p>&#160;&#160; params.put("java.naming.security.principal", username);</p><p>&#160;&#160; params.put("java.naming.security.credentials", password);</p><p>5. After make InitialContext call LoginContext.login() with CallbackHandler, what return username and password (overlapping of #4)</p><p>6. Try get remote interface (lookup) and failed:</p><p>2:09:04.629:Remoting "config-based-naming-client-endpoint" read-1:ERROR:org.jboss.remoting.remote.connection::JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed</p><p>12:09:04.629:main&#160;&#160;&#160;&#160;&#160;&#160;&#160; :TRACE:ru.infosfera.common.ejb.JndiHelper&#160; ::not found jndiName: ejb:StartNg.twf-3.S3-SNAPSHOT/Common.auth.ejb-3.S3-SNAPSHOT//AdmContextBL!ru.infosfera.common.auth.bl.AdmContextRemote</p><p>javax.security.auth.login.LoginException: Failed to create remoting connection</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>7. In server NO LOG from my RolesLoginModule.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span class="short_text" id="result_box" lang="en"><span class="hps">What am I doing</span> <span class="hps">wrong?</span></span></p><p><span class="short_text" id="result_box" lang="en"><span class="hps">How to</span> <span class="hps">do the right thing</span><span>?</span></span></p></div>

</td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>