diff --git a/wsit/ws-sx/wssx-api/src/main/java/com/sun/xml/ws/api/security/trust/client/IssuedTokenManager.java b/wsit/ws-sx/wssx-api/src/main/java/com/sun/xml/ws/api/security/trust/client/IssuedTokenManager.java index ec0d02132..7d9aee674 100644 --- a/wsit/ws-sx/wssx-api/src/main/java/com/sun/xml/ws/api/security/trust/client/IssuedTokenManager.java +++ b/wsit/ws-sx/wssx-api/src/main/java/com/sun/xml/ws/api/security/trust/client/IssuedTokenManager.java @@ -39,6 +39,12 @@ public static IssuedTokenManager getInstance(){ } } + public static void reInitialize(){ + synchronized (IssuedTokenManager.class) { + manager = new IssuedTokenManager(); + } + } + public IssuedTokenContext createIssuedTokenContext(IssuedTokenConfiguration config, String appliesTo){ IssuedTokenContext ctx = new IssuedTokenContextImpl(); ctx.getSecurityPolicy().add(config); diff --git a/wsit/ws-sx/wssx-impl/src/main/java/com/sun/xml/wss/impl/misc/DefaultCallbackHandler.java b/wsit/ws-sx/wssx-impl/src/main/java/com/sun/xml/wss/impl/misc/DefaultCallbackHandler.java index 6722d8cc6..317df1aff 100644 --- a/wsit/ws-sx/wssx-impl/src/main/java/com/sun/xml/wss/impl/misc/DefaultCallbackHandler.java +++ b/wsit/ws-sx/wssx-impl/src/main/java/com/sun/xml/wss/impl/misc/DefaultCallbackHandler.java @@ -215,6 +215,7 @@ public class DefaultCallbackHandler implements CallbackHandler { private Class truststoreCertSelectorClass; private String useXWSSCallbacksStr; private boolean useXWSSCallbacks; + private static final String SECURITY_ENV_PATH_LOCATION = "com.sun.xml.wss.security-env-properties"; public DefaultCallbackHandler(String clientOrServer, Properties assertions) throws XWSSecurityException { @@ -222,7 +223,7 @@ public DefaultCallbackHandler(String clientOrServer, Properties assertions) thro if (assertions != null && !assertions.isEmpty()) { properties = assertions; } else { - //fallback option + //1st fallback option properties = new Properties(); String resource = clientOrServer + "-security-env.properties"; InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); @@ -231,9 +232,32 @@ public DefaultCallbackHandler(String clientOrServer, Properties assertions) thro properties.load(in); } catch (IOException ex) { throw new XWSSecurityException(ex); + } finally { + try { + in.close(); + } catch (IOException e) {} } } else { - //throw new XWSSecurityException("Resource " + resource + " could not be located in classpath"); + //2nd and 3rd fallback check system properties + String path = System.getProperty(SECURITY_ENV_PATH_LOCATION); + if(path==null) { + path = java.lang.System.getenv(SECURITY_ENV_PATH_LOCATION); + } + if(path!=null) { + try { + in = new FileInputStream(path); + properties.load(in); + } catch (IOException ex) { + throw new XWSSecurityException(ex); + } finally { + try { + if(in!=null) in.close(); + }catch (IOException e) {} + } + } + else { + //throw new XWSSecurityException("Resource " + resource + " could not be located in the classpath nor in the file system."); + } } }