4 Replies Latest reply on Mar 12, 2003 8:42 AM by Stefan Heckler

    Problem Deploying JBoss Client with WebStart

    Stefan Heckler Novice

      I would like to deploy the client jar files using WebStart. Im am using JAAS for authentification and a SecurityManager. As WebStart only downloads jarfiles, the SystemProperty settings like java.security.auth.login.config=filename or
      java.security.policy=filename will not work.
      Therefore I tried to point the SystemProperty to an URL like that:

      ClassLoader cl = this.getClass().getClassLoader();
      URL url = cl.getResource("auth.conf");
      System.setProperty("java.security.auth.login.config", url.getFile());


      url.getFile() deliveres the following string: "file:/D:/daten/../myjar.jar!/client.policy" and client.policy file does exist at that position in the jar,
      but it does not work. The system behaves as if the Property has not been set. What is wrong?

      Thanks for any help
      Stefan Heckler


        • 1. Re: Problem Deploying JBoss Client with WebStart
          Rob Stokes Newbie

          The following code works for me:

          Properties prop = System.getProperties();
          ClassLoader classLoader = this.getClass().getClassLoader();
          String file = classLoader.getResource("auth.conf").toString();
          prop.setProperty("java.security.auth.login.config", file);

          • 2. Re: Problem Deploying JBoss Client with WebStart
            Rob Stokes Newbie

            The following works for me:

            Properties prop = System.getProperties();
            ClassLoader classLoader = this.getClass().getClassLoader();
            String file = classLoader.getResource("auth.conf").toString();
            prop.setProperty("java.security.auth.login.config", file);

            • 3. Re: Problem Deploying JBoss Client with WebStart
              Peter Doornbosch Apprentice

              What is wrong is that the sun implementation of the Jaas configuration class does not understand url's, it can only load 'normal' files.

              I've run into the same trouble, also using webstart. I solved it by simply not using the sun configuration class, but my own (see attachment). This class lets you set the jaas configuration programmatically, which is very convenient in a webstart environment ;-).
              The basic idea of Jaas that configuration of the login modules can be done _outside_ the application is violated by this solution, although that depends on how you implement it on the server of course. I cannot image a situation where the webstart user might want to change the login configuration (well, maybe he wants, but the system administrator won't let him ;-); you can still program it in such a way that the system adminstrator can change the login configuration on the server for webstart clients.

              Hth,
              Peter

              • 4. Re: Problem Deploying JBoss Client with WebStart
                Stefan Heckler Novice

                My workaround is the follwing: extracting the file from the jar temporaryly and setting the property - this works with webstart (you need ofcourse to sign the jars to get write permission on the local pc)

                try {

                File file = new File("auth.conf");
                PrintWriter out = new PrintWriter(new FileWriter(file));
                String line;
                System.out.println("Reading login configuration from " + cl.getResource("de/psi/cmd/psi_auth.conf").getPath());
                BufferedReader in =
                new BufferedReader(
                new InputStreamReader(
                cl.getResourceAsStream("de/psi/cmd/psi_auth.conf")));


                while((line = in.readLine()) != null) {
                out.println(line);
                }

                out.close();
                in.close();


                System.setProperty("java.security.auth.login.config", "auth.conf");

                } catch (Exception e) {
                System.err.println("Error setting System.property: " + e.getMessage());
                }