2 Replies Latest reply on Feb 7, 2007 2:31 AM by narasimha murthy

    Have problem about "org.jboss.security.ClientLoginModule "

    LeQuoc Thai Novice

      Hi all !
      On the client, I write:
      String path = Test.class.getProtectionDomain().getCodeSource().getLocation().getPath();
      if (path.endsWith(".jar"))
      path = path.substring(0, path.lastIndexOf("\\"));
      System.getProperties().setProperty("java.security.auth.login.config", path + "user.conf");
      System.getProperties().setProperty("java.security.policy", path + "user.policy");
      System.setSecurityManager(new SecurityManager());

      LoginContext lc = new LoginContext("clientTest", new MyCallbackHandler());
      And my user.config:
      userTest {
      org.jboss.security.ClientLoginModule required;
      And my user.policy:
      grant codebase "file:/-" {
      permission javax.security.auth.AuthPermission "createLoginContext.clientTest";
      permission java.util.PropertyPermission "*", "read";
      permission java.security.AllPermission;
      After I enter username and password. I receive some messages:
      Exception in thread "main" javax.security.auth.login.LoginException: Security Exception
      at javax.security.auth.login.LoginContext.invoke(Unknown Source)
      at javax.security.auth.login.LoginContext.access$000(Unknown Source)
      at javax.security.auth.login.LoginContext$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)
      at javax.security.auth.login.LoginContext.login(Unknown Source)
      at client.test.Test.main(Test.java:34)
      Caused by: java.lang.SecurityException
      ... 7 more
      Have any idea ? Thanks.

        • 1. Re: Have problem about
          jaikiran pai Master

          I dont think, you need all this to login using JAAS. Its pretty simple, you need to have the user.conf in your classpath and add using System.setProperty. Also, i see a problem in the code that you have:

          LoginContext lc = new LoginContext("clientTest", new MyCallbackHandler());

          Shouldnt "clientTest" be "userTest" since your user.conf mentions userTest?

          • 2. Re: Have problem about
            narasimha murthy Newbie

            Hi Jaikiran,

            I have a problem with config file. I am using jboss server. my code is not able to locate the config file which i put in the same path from where i am instanciating the loginContext. But when I am configuring it in jboss\server\default\conf\login-conf.xml file. It was abled to locate the LoginModule. Can you please tell me how to make it possible form config file it self, because i want to use my own LoginModule.

            Thanks in Advance