users@glassfish.java.net

Problem in using jdbc realm, i get "No LoginModules configured for jdbcrealm"

From: Legolas Woodland <legolas.w_at_gmail.com>
Date: Thu, 29 Nov 2007 14:17:27 +0430

Problem in using jdbc realm, i get "No LoginModules configured for
jdbcrealm"
Hi
Thank you for reading my post
I have configured a
1- connection pool
2- date source pointing to that pool
3- adding some users and groups to the database table
4- creating a jdbc realm using several tutorial which are available in the
web for a jdbc tutorial
5- add configuration to web.xml and sun-web.xml
6- trying to use the realm and i get the following exception (when using
finest level of logging)

Processing login with credentials of type: class
com.sun.enterprise.security.auth.login.PasswordCredential
Logging in user [admin] into realm: jdbcrealm using JAAS module: jdbcrealm
SEC5046: Audit: Authentication refused for [admin].
doPasswordLogin fails
javax.security.auth.login.LoginException: No LoginModules configured for
jdbcrealm
        at javax.security.auth.login.LoginContext.init(LoginContext.java
:256)
        at javax.security.auth.login.LoginContext.<init>(LoginContext.java
:367)
        at javax.security.auth.login.LoginContext.<init>(LoginContext.java
:444)
        at
com.sun.enterprise.security.auth.LoginContextDriver.doPasswordLogin(
LoginContextDriver.java:294)
        at com.sun.enterprise.security.auth.LoginContextDriver.login(
LoginContextDriver.java:170)
        at com.sun.enterprise.security.auth.LoginContextDriver.login(
LoginContextDriver.java:123)
        at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java
:479)
        at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java
:419)
        at org.apache.catalina.authenticator.BasicAuthenticator.authenticate
(BasicAuthenticator.java:161)
        at com.sun.web.security.RealmAdapter.invokeAuthenticateDelegate(
RealmAdapter.java:1146)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
AuthenticatorBase.java:627)
        at org.apache.catalina.core.StandardPipeline.doInvoke(
StandardPipeline.java:609)
        at org.apache.catalina.core.StandardPipeline.doInvoke(
StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(
StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(
StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(
StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(
StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(
CoyoteAdapter.java:270)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(
DefaultProcessorTask.java:637)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(
DefaultProcessorTask.java:568)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(
DefaultProcessorTask.java:813)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask
(DefaultReadTask.java:339)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(
DefaultReadTask.java:261)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(
DefaultReadTask.java:212)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(
TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(
SSLWorkerThread.java:106)
Web login failed: Login failed: javax.security.auth.login.LoginException: No
LoginModules configured for jdbcrealm


the realm name is jdbcrealm and "jass context" attribute value is
"jdbcrealm",
I made the role and group mapping correctly and i used "jdbcrealm" as the
realm name in web.xml configuration.
Is there some other places to register the realm in order to make it
possible for the application server/ web application use it?

Here is web.xml content:

 <security-constraint>
       <display-name>protect_all</display-name>
       <web-resource-collection>
           <web-resource-name>protected</web-resource-name>
           <description/>


            <url-pattern>/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>PUT</http-method>
            <http-method>HEAD</http-method>
            <http-method>POST</http-method>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
            <http-method>DELETE</http-method>
            </web-resource-collection>
        <auth-constraint>
            <description>sample description</description>
            <role-name>ADMINISTRATORS</role-name>
            <role-name>USERS</role-name>
            </auth-constraint>
        </security-constraint>
    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>jdbcrealm</realm-name>
        </login-config>
    <security-role>
       <description/>
       <role-name>USERS</role-name>
   </security-role>
   <security-role>
       <description/>
       <role-name>ADMINISTRATORS</role-name>
   </security-role>


Here is sun-web.xml content:

 <security-role-mapping>
    <role-name>USERS</role-name>
    <group-name>USERS</group-name>
  </security-role-mapping>
  <security-role-mapping>
    <role-name>ADMINISTRATORS</role-name>
    <group-name>ADMINISTRATORS</group-name>
  </security-role-mapping>

here is realm definition in domain.xml:


 <auth-realm classname="
com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm" name="jdbcrealm">
          <property name="jaas-context" value="jdbcrealm"/>
          <property name="datasource-jndi" value="jdbc/certhauth"/>
          <property name="user-table" value="USERTABLE"/>
          <property name="user-name-column" value="USERID"/>
          <property name="password-column" value="PASSWORD"/>
          <property name="group-table" value="GROUPTABLE"/>
          <property name="group-name-column" value="GROUPID"/>
          <property name="digest-algorithm" value="NONE"/>
        </auth-realm>



What did i miss here?

Thanks