1 Reply Latest reply on Jan 28, 2008 7:23 AM by deappel

    How to read users/roles from a database?

    deappel

      Hi,

      I;ve managed to create a loginModule with hardcoded users, although it works i want to be able to read the users and roles from a database but i'm not sure how to proceed. I've read the tutorials but it doesnt work for me.

      my loginconfig:

      DOCTYPE policy
      PUBLIC "-//JBoss//DTD JBOSS Security Config 3.0//EN"
      "http://www.jboss.org/j2ee/dtd/security_config.dtd">


      <application-policy name="testDB">

      <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
      flag="required">
      <module-option name="dsJndiName">java:/MyDatabaseDS</module-option>
      <module-option name="principalsQuery">
      select passwd from Users username where username=?</module-option>
      <module-option name="rolesQuery">
      select userRoles, 'Roles' from UserRoles where username=?</module-option>
      </login-module>

      </application-policy>




      jbossservice:

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE server
      PUBLIC "-//JBoss//DTD MBean Service 4.0//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd"
      >



      META-INF/login-config.xml
      <depends optional-attribute-name="LoginConfigService">
      jboss.security:service=XMLLoginConfig

      <depends optional-attribute-name="SecurityManagerService">
      jboss.security:service=JaasSecurityManager




      does anyone know how to read users from a database using jboss 4.2.x ?

      Thanks