0 Replies Latest reply: Jan 26, 2010 1:13 PM by 807573 RSS

    Access Manager Client SDK Java Usage with multiple OpenSSO instances

    807573
      I am having some problems using the SDK / API for connecting to OpenSSO in a Java multi-threaded environment, while connecting to multiple instances of OpenSSO.
      Is there a way to setup a new AuthContext that does not include 1) Use of global configuration AMConfig.properties or 2) Stick stuff in SystemProperties?

      I see a constructor that takes an OpenSSO url, but the 2nd parameter seems to be ignored. .I.e. com.sun.identity.authentication.AuthContext.AuthContext(String orgName, URL url). I can login if I use the naming service url using "com.iplanet.am.naming.url" with the following code, but for this to work while connecting to multiple OpenSSO servers, I have to synchronized the calls and create the context each time I want to perform an API call.

      THIS WORKS:
                String realm = "/";
                String strUrl = url.toExternalForm();
                
                // from AM server's AMConfig.properties
                Properties amEnv = new Properties();
                amEnv.setProperty("com.iplanet.am.naming.url", strUrl);
                amEnv.setProperty("com.iplanet.am.naming.failover.url", "");
                amEnv.setProperty("com.iplanet.services.debug.level", "message");
                amEnv.setProperty("com.iplanet.services.debug.directory", "/tmp/debug");
                amEnv.setProperty("com.iplanet.security.encryptor",     "com.iplanet.services.util.JSSEncryption");
                amEnv.setProperty("am.encryption.pwd", "BXo8vzOHob8FTpR6da+cSAi0TPLTH2Q/");
                
                SystemProperties.initializeProperties(amEnv);          

                lc = new AuthContext(realm);

      THIS DOESN'T:
                amEnv.setProperty("com.iplanet.am.naming.url", "");
                ...
                lc = new AuthContext(realm, strUrl);

      In my ideal scenario, I'd like to cache a number of different AuthContext instances which connect to a number of different OpenSSO servers. When trying the second scenario, I get the following error message:
      "Failed to create new Authentication Context: {0}"

      Ideas?