Version 4

    How To Configure JBoss Mail Server 1.0M3 to use the DatabaseServerLoginModule

     

    If you have already read this section skip to the bottom for the DatabaseServerLoginModel specifics

     

     

     

     

    Configure login-config.xml for DatabaseServerLoginModule

     

    versions: 1.0M3

     

    Add a section to login-config.xml that looks like this:

     

        <!-- Security domain for JBoss Mail Server -->
        <application-policy name = "jboss-mail"> <!-- must match what is specified in 
                                                      $JBOSS_HOME/server/$CONFIG/deploy/mail.ear/mail.sar/META-INF ! -->
           <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 PASSWD FROM JMS_USERS WHERE USERID=?</module-option>
                 <module-option name = "rolesQuery">SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?</module-option>
              </login-module>
           </authentication>
        </application-policy>
    

     

    You can use any datasource that you like, but we suggest you use the same one that your mail is stored in for various reasons that are out of scope for this document.

     

    You can also change the queries above however the order of the columns returned matters (but not the names) and only the single "user" parameter which replaces the ? will be provided

     

    Restart

     

    This change requires you to fully restart the JBAS instance.  You can do this by running bin/shutdown -S or hitting CTRL-C if you are running in the present console, then running bin/run.sh (-c configname if required).

     

    Final thoughts

     

    You may need to recreate the users you had defined in the installer or StaticUserRepository.  Don't worry their mail isn't lost but you need to add them to the database or they will not be able to log in to get their mail!  If they had no mail yet then don't worry about it.