3 Replies Latest reply on Feb 14, 2008 12:36 AM by jaikiran pai

    Hibernate using SecureIdentityLoginModule for accessing Data

    Vineeth Prabhu Newbie

      Hi,
      We have a datasource that is configured to use the encrypted password. This password was generated usingthe SecureIdentityLoginModule. Now, when i give the reference of the JNDI name in the hibernate.cfg.xml, its giving a improper authentication error. Below is the exceprt from login-config, oracle-ds and hibernate.cfg.xml. Also is the stack trace. Please let me know how to go about this issue. Thanks in advance:

      oracle-ds.xml:
      <jndi-name>OracleDS</jndi-name>
      <security-domain>EncryptedDB</security-domain>

      login-config.xml:
      <application-policy name="EncryptDBPassword">

      <login-module code="org.jboss.resource.security.SecureIdentityLoginModule" flag="required">
      <module-option name = "principal">xxx</module-option>
      <module-option name="username">xxx</module-option>
      <module-option name="password">-108e007144adcb78</module-option>
      <module-option name="managedConnectionFactoryName">jboss.jca:name=OracleDS,service=LocalTxCM</module-option>
      </login-module>

      </application-policy>




      hibernate.cfg.xml:

      java:/OracleDS


      Error Message:
      03:31:30,889 ERROR [UsersRolesLoginModule] Failed to load users/passwords/role files
      java.io.IOException: No properties file: users.properties or defaults: defaultUsers.properties found
      at org.jboss.security.auth.spi.Util.loadProperties(Util.java:315)
      at org.jboss.security.auth.spi.UsersRolesLoginModule.loadUsers(UsersRolesLoginModule.java:186)
      at org.jboss.security.auth.spi.UsersRolesLoginModule.createUsers(UsersRolesLoginModule.java:200)
      at org.jboss.security.auth.spi.UsersRolesLoginModule.initialize(UsersRolesLoginModule.java:127)
      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:585)
      at javax.security.auth.login.LoginContext.invoke(LoginContext.java:756)
      at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
      at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
      at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
      at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)
      at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getSubject(BaseConnectionManager2.java:588)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:395)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
      at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
      at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
      at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1132)
      at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:766)
      at net.sf.hibernate.jmx.HibernateService.buildSessionFactory(HibernateService.java:176)