0 Replies Latest reply on Aug 12, 2002 11:58 AM by Dirk Niemeier

    DatabaseServerLoginModule in JBoss 3.0.1

    Dirk Niemeier Newbie

      I try to user DatabaseServerLoginModule for my client to authenticate. But I get an client error like this :
      java.lang.SecurityException: Anmeldekonfiguration kann nicht gefunden werden.
      (auth configuration can't be found)
      I think I have to configure the client site to use the DatabaseServerLoginModule, but how ?
      TIA
      Dirk


      My client :
      class MyHandler implements CallbackHandler
      {
      private String username;
      private char[] password;
      public MyHandler(String usr, char[] passwd)
      {
      username=usr;
      password=passwd;
      };
      public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
      {
      for (int i = 0; i < callbacks.length; i++)
      {
      if (callbacks instanceof NameCallback)
      {
      NameCallback nc = (NameCallback)callbacks
      ;
      nc.setName(username);
      System.out.println("UserCallback");
      }
      else if (callbacks instanceof PasswordCallback)
      {
      PasswordCallback pc = (PasswordCallback)callbacks
      ;
      pc.setPassword(password);
      System.out.println("PasswortCallback");
      }
      else
      {
      throw new UnsupportedCallbackException(callbacks, "Unrecognized Callback");
      }
      }
      }
      }

      MyHandler handler = new MyHandler((String)benutzerFeld.getSelectedItem(), passwortFeld.getPassword());
      LoginContext lc = new LoginContext("testSicherheit", handler);
      //LoginContext lc = new LoginContext("testSicherheit", handler);
      lc.login();


      My login-config.xml :

      <application-policy name = "testSicherheit">

      <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
      <module-option name="dsJndiName">java:/InformixDS</module-option>
      <module-option name="principalsQuery">select passwd from benutzer where username=?</module-option>
      <module-option name="rolesQuery">select ejb_role, ejb_rolegroup from benutzer, gruppenmitglied where gruppenmitglied.userid=benutzer.id and username=?</module-option>
      </login-module>

      </application-policy>