[jboss-user] [Datasource Configuration] - Realm configuration problems using DataSourceRealm

Patrick Mingard do-not-reply at jboss.com
Fri May 21 02:52:54 EDT 2010


Patrick Mingard [http://community.jboss.org/people/Lordsephiroth] replied to the discussion

"Realm configuration problems using DataSourceRealm"

To view the discussion, visit: http://community.jboss.org/message/544144#544144

--------------------------------------------------------------
Hi again,

After a while on french forums, someone gave me a hint to resolve my problem. In fact, I did not really resolve it but changed completely to something similar. I post here for the case someone searching for the same answer falls on my topic.

Here is the configuration of the WEB-INF/web.xml file (security part only) :

<security-constraint>
  <display-name>Security constraint for Currency Manager</display-name>
  <web-resource-collection>
   <web-resource-name>Protected area</web-resource-name>
   <url-pattern>/servlet/CurrencyConverter</url-pattern>
  </web-resource-collection>
  <auth-constraint>
   <role-name>admin</role-name>
  </auth-constraint>
 </security-constraint>
 <login-config>
  <auth-method>FORM</auth-method>
  <realm-name>CurrencyManager</realm-name>
  <form-login-config>
   <form-login-page>/login.jsp</form-login-page>
   <form-error-page>/loginerror.jsp</form-error-page>
  </form-login-config>
 </login-config>
 <security-role>
  <role-name>admin</role-name>
 </security-role>


Here is the WEB-INF/jboss-web.xml file I placed

<jboss-web>
     <security-domain>java:/jaas/currencysecurity</security-domain>
</jboss-web>


Here is where it becomes really different, I did change the server\default\conf\login-config.xml file of my JBoss config. Just add a new application-policy with this configuration and I worked perfectly well for me.

<application-policy name="currencysecurity"> 
    <authentication> 
        <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" 
                         flag="required"> 
            <module-option name="dsJndiName">java:/DefaultDS</module-option> 
            <module-option name="principalsQuery">   
                select user_pass from users where user_name=? 
            </module-option> 
            <module-option name="rolesQuery"> 
                select role_name,'Roles' from user_roles where user_name=? 
            </module-option> 
        </login-module> 
    </authentication> 
</application-policy>

Hope this will help someone some day  ;) 

Cya soon for new questions !

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/544144#544144]

Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100521/94e0183a/attachment.html 


More information about the jboss-user mailing list