jboss7.xjaasdatabase-server

JAAS DatabaseServerLoginModule rolesQuery does not return user roles


I'm using JAAS with JBoss as 7. The login module used is DatabaseServerLoginModule. Here is my configuration:

<login-module code="Database" flag="required">
    <module-option name="dsJndiName" value="java:jboss/datasources/oracleDS"/>
    <module-option name="principalsQuery" value="SELECT PASSWD FROM FO.USERS WHERE USERNAME=?"/>
    <module-option name="rolesQuery" value="SELECT USERROLES, 'ROLES' FROM FO.USERROLES WHERE USERNAME=?"/>
</login-module>

The authentication occurred successfully without any problems (the login module is able to recuperate the password of the given username). But my problem is that it can not recuperate the roles using the rolesQuery and thus the authorization fails. For example for a user krisv with role dme, if I execute the rolesQuery inside a scrapbook in eclipse i got this result: enter image description here
However when I want to access a web page that has role dme as auth-constraint i get the following: enter image description here


Solution

  • The 'ROLES' parts is read by JBOSS and it only understands camelcase it should read 'Roles' tell me how that works out for you

    "SELECT USERROLES, 'Roles' FROM FO.USERROLES WHERE USERNAME=?"