<?xml version='1.0'?>
<!DOCTYPE policy PUBLIC
      "-//JBoss//DTD JBOSS Security Config 3.0//EN"
      "http://www.jboss.org/j2ee/dtd/security_config.dtd">

<policy>


     <application-policy name = "SecurityRealm">
       <authentication>
          <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"  flag = "required">
             <module-option name = "dsJndiName">java:/Security</module-option>
             <module-option name="principalsQuery">SELECT password AS Password FROM user WHERE name = ?</module-option>
             <module-option name="rolesQuery">SELECT RL.name AS Roles, 'Roles' AS RoleGroups FROM role as RL, user as U ,  users_roles as RU WHERE U.userid = RU.userid and RU.roleid = RL.roleid  and U.name = ?</module-option>
                <module-option name="debug">true</module-option>
              <module-option name="hashAlgorithm">MD5</module-option>
              <module-option name="hashEncoding">hex</module-option>
          </login-module>
       </authentication>
  </application-policy>    
  
   

</policy>

