0 Replies Latest reply on Apr 6, 2003 10:03 PM by mcervantes

    Authentication of Schedulable instance

    mcervantes Newbie

      So far my experience with JBoss has been excellent, but I've finally hit a major hang-up. My set-up has been rather elegant at this point, I'm hoping this problem won't require me to ruin that.

      I've got a set of EJB's that are accessed by remote clients. The EJBs are deployed within a single security realm. The clients are authenticated using the DatabaseServerLoginModule, so they require the location of auth.conf (where the login module is referenced) to be specified as a system property on startup.

      Here's the issue: I also have a Schedulable instance - call it the Pumper - that calls a single method in one of the EJB's periodically. The problem is: how does he get authenticated? It seems to silly to try and define a single value for java.security.auth.login.config for the entire JBoss JVM, and this doesn't seem to work anyway.

      I'd prefer a solution that avoids storing passwords in cleartext, but I'd go for almost anything right now.

      My current code looks like this:

      SecurityAssociationHandler handler = new SecurityAssociationHandler();
      Principal principal = new Principal() {
      public String getName() {
      return "mike";
      }
      };
      handler.setSecurityInfo(principal,"testing".toCharArray());
      LoginContext loginContext = new LoginContext("VentexSecurityDomain",handler);
      loginContext.login();

      Context ctx = new InitialContext();
      AutomatedQueryExecutorHome automatedQueryExecutorHome =
      (AutomatedQueryExecutorHome) ctx.lookup("AutomatedQueryExecutorHome");
      AutomatedQueryExecutor automatedQueryExecutor = automatedQueryExecutorHome.create();
      automatedQueryExecutor.runAutomatedQueries();

      (Note I wouldn't normally hardcode username/pw, I'm just trying to get it to work.)

      The error:

      21:56:00,000 ERROR [UsersRolesLoginModule] Failed to load users/passwords/role f
      iles
      java.io.IOException: Properties file users.properties not found
      at org.jboss.security.auth.spi.UsersRolesLoginModule.loadProperties(User
      sRolesLoginModule.java:212)
      at org.jboss.security.auth.spi.UsersRolesLoginModule.loadUsers(UsersRole
      sLoginModule.java:193)
      at org.jboss.security.auth.spi.UsersRolesLoginModule.initialize(UsersRol
      esLoginModule.java:95)
      at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at javax.security.auth.login.LoginContext.invoke(LoginContext.java:662)

      Thanks in advance...