4 Replies Latest reply on Apr 28, 2005 3:27 AM by Janath Raveendra

    Authentication & autoritation exception

    lalala Newbie

      Hi!

      I'm so desperate with jboss & jaas.
      The login method throws me this exception :

      javax.security.auth.login.LoginException: javax.naming.NameNotFoundException: MyAplDS not bound
      at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:110)
      at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:150)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at javax.security.auth.login.LoginContext.invoke(LoginContext.java:675)
      at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
      at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
      at javax.security.auth.login.LoginContext.login(LoginContext.java:534)

      in my login-config.xml I have this:


      <application-policy name = "MyAplDbRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
      <module-option name = "principal">user</module-option>
      <module-option name = "userName">user</module-option>
      <module-option name = "password">pass</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MyAplDS</module-option>
      </login-module>

      </application-policy>

      <application-policy name="application">

      <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
      <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MyAplDS</module-option>
      <module-option name="dsJndiName">java:/MyAplDS</module-option>
      <module-option name="principalsQuery">select password from ludatuser where username=?</module-option>
      <module-option name="rolesQuery">select role, rolegroup from ludatroles where username=?</module-option>
      </login-module>

      </application-policy>

      but it seems that my jboss doesn't read this, it reads the .java.login.config that i have in %userhome%, this archive contains:

      application {
      org.jboss.security.auth.spi.DatabaseServerLoginModule required debug=true
      dsJndiName="java:/MyAplDS"
      principalsQuery="select password from ludatuser where username=?"
      rolesQuery="select role, rolegroup from ludatroles where username=?"
      unauthenticatedIdentity=nobody
      ;
      };

      If I remove this file, the login process throws an exception:

      java.lang.SecurityException: Unable to locate a login configuration
      at com.sun.security.auth.login.ConfigFile.(ConfigFile.java:97)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      ? lines deleted
      at javax.security.auth.login.LoginContext$1.run(LoginContext.java:170)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.init(LoginContext.java:167)
      at javax.security.auth.login.LoginContext.(LoginContext.java:393)
      at weblogic.security.internal.ServerAuthenticate.main(ServerAuthenticate)

      Anyone can help me???

      Thanks