1 Reply Latest reply on Nov 24, 2004 9:21 PM by Scott Stark

    using DynamicLoginConfig

    cglommen Newbie

      I was successfully utlizing a custom login module that subclasses UsernamePasswordLoginModule where I defined the policy statically in the login-config.xml file. But, I was deploying the module with an ejb, which I didn't want to do. Desiring to deploy the security external to the ejb, I chose to utilize DynamicLoginConfig. So, I did the following:

      1. jar'ed the custom UsernamePasswordLoginModule class and put that into the server/default/lib directory.
      2. created the following custom login-config.xml (named custom-login-config.xml) file and placed that into the deploy directory:

      <policy>
       <application-policy name="client">
       <authentication>
       <login-module code="com.MyCustomUserPassLoginModule" flag="required"/>
       </authentication>
       </application-policy>
      </policy>


      3. created what I think deploys it (called custom-login-deployer.xml) and placed it too in the deploy directory:
      <server>
       <mbean code="org.jboss.security.auth.login.DynamicLoginConfig" name="jboss.security.tests:service=DynamicLoginConfig">
       <attribute name="AuthConfig">custom-login-config.xml</attribute>
       <depends optional-attribute-name="LoginConfigService">jboss.security:service=XMLLoginConfig</depends>
       </mbean>
      </server>


      However, now when I deploy my ejb, I get the following stack trace, which shows that it is now using UsersRolesLoginModule. (which I did not change at all, and worked fine using the correct security domain that was statically defined in login-config.xml)

      What am I doing wrong? Why isn't the dynamic login configuration working?


      ERROR [UsersRolesLoginModule] Failed to load users/passwords/role files
      java.io.IOException: Properties file users.properties not found
      at org.jboss.security.auth.spi.UsersRolesLoginModule.loadProperties(UsersRolesLoginModule.java:217)
      at org.jboss.security.auth.spi.UsersRolesLoginModule.loadUsers(UsersRolesLoginModule.java:234)
      at org.jboss.security.auth.spi.UsersRolesLoginModule.initialize(UsersRolesLoginModule.java:100)
      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:662)
      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)
      at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:491)
      at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:442)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:257)
      at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:232)
      at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:239)
      at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:129)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)


        • 1. 3820372
          Scott Stark Master

          The deploy directory is not on the server classpath and so files sitting in there are cannot be located as resources. Put the custom-login-config.xml in the server/default/conf directory and this works fine for me.