<!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;">
    JAAS Login issue
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/ionutvaidianu">ionutvaidianu</a> in <i>Beginner's Corner</i> - <a href="https://community.jboss.org/message/728886#728886">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I'm quite new to JBoss AS, so please bare with me and any help is appreciated.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Here is my problem: I have a RichFaces web application and I want to restrict access to most of the pages. As far as I have found so far the best way (opened for suggetions and debate here) to secure content is at container level by defining a security domain and a module that will authorize the users so they can be able to access secured pages. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have done all the configuration, the pages are protected, but even from a user that authenticates. In other words event after authentication I get redirected to the login page and cannot access any of the protected pages. I get no error / message in the server console (The log level for CONSOLE is on DEBUG).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Is it a known issue, is there a WA for it or am I doing something wrong?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks!</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Here is the setup:</p><p>JBoss AS 7.1.1 Final, standalone configuration.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The security domain (the associated datasource is functional because at some point I got wrong password in the server console):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;security-domain name="SecuredRealm"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;authentication&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;login-module code="Database" flag="required"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module-option name="dsJndiName" value="java:jboss/datasources/securityDS"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module-option name="principalsQuery" value="select passwd from Users where username=?"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module-option name="rolesQuery" value="select userRoles,'Roles' from UserRoles where username=?"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module-option name="hashAlgorithm" value="MD5"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module-option name="hashEncoding" value="base64"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module-option name="unauthenticatedIdentity" value="guest"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;module-option name="maxInvalidLoginAttempts" value="5"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/login-module&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/authentication&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/security-domain&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>jboss-web.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</p><p>&lt;jboss-web&gt;</p><p>&#160;&#160;&#160; &lt;security-domain&gt;java:/jaas/SecuredRealm&lt;/security-domain&gt;</p><p>&lt;/jboss-web&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>web.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><table><tbody><tr><td style=";"><br/></td><td style=";">&lt;security-constraint&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;web-resource-collection&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;web-resource-name&gt;SecuredRealm&lt;/web-resource-name&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;url-pattern&gt;/*&lt;/url-pattern&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;http-method&gt;GET&lt;/http-method&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;http-method&gt;POST&lt;/http-method&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;/web-resource-collection&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;auth-constraint&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;role-name&gt;*&lt;/role-name&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;/auth-constraint&gt;</td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><table><tbody><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;!-- &lt;user-data-constraint&gt; --&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;!-- &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt; --&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;!-- &lt;/user-data-constraint&gt; --&gt;</td></tr><tr><td style=";"><br/></td><td style=";">&lt;/security-constraint&gt;</td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><table><tbody><tr><td style=";"><br/></td><td style=";">&lt;security-constraint&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;web-resource-collection&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;web-resource-name&gt;Unprotected area&lt;/web-resource-name&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;url-pattern&gt;/resources/*&lt;/url-pattern&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;/web-resource-collection&gt;</td></tr><tr><td style=";"><br/></td><td style=";">&lt;/security-constraint&gt;</td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><table><tbody><tr><td style=";"><br/></td><td style=";">&lt;login-config&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;auth-method&gt;FORM&lt;/auth-method&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;realm-name&gt;SecuredRealm&lt;/realm-name&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;form-login-config&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;form-login-page&gt;/jasl.jsf&lt;/form-login-page&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;form-error-page&gt;/jasl.jsf&lt;/form-error-page&gt;</td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;/form-login-config&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";">&lt;/login-config&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";">&lt;security-role&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;role-name&gt;admin&lt;/role-name&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";">&lt;/security-role&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";">&lt;security-role&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";"><br/></td><td style=";">&lt;role-name&gt;normal&lt;/role-name&gt;</td><td style=";"><br/></td></tr><tr><td style=";"><br/></td><td style=";">&lt;/security-role&gt;</td><td style=";"><br/></td></tr></tbody></table></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/728886#728886">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


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

</div>

</body>
</html>