Author: richard.opalka(a)jboss.com
Date: 2011-03-09 06:16:13 -0500 (Wed, 09 Mar 2011)
New Revision: 13872
Modified:
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityActions.java
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityDecoder.java
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityEncoder.java
Log:
[JBWS-3243] fixing TCCL WSSecurity issue
Modified:
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityActions.java
===================================================================
---
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityActions.java 2011-03-08
18:45:04 UTC (rev 13871)
+++
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityActions.java 2011-03-09
11:16:13 UTC (rev 13872)
@@ -59,6 +59,30 @@
}
/**
+ * Set context classloader.
+ *
+ * @param classLoader the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+ else
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+ /**
* Get a system property
*
* @param name
Modified:
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityDecoder.java
===================================================================
---
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityDecoder.java 2011-03-08
18:45:04 UTC (rev 13871)
+++
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityDecoder.java 2011-03-09
11:16:13 UTC (rev 13872)
@@ -26,6 +26,7 @@
import java.util.HashSet;
import java.util.List;
+import org.apache.xml.security.Init;
import org.jboss.ws.extensions.security.element.EncryptedKey;
import org.jboss.ws.extensions.security.element.SecurityHeader;
import org.jboss.ws.extensions.security.element.SecurityProcess;
@@ -35,7 +36,6 @@
import org.jboss.ws.extensions.security.element.UsernameToken;
import org.jboss.ws.extensions.security.exception.WSSecurityException;
import org.jboss.ws.extensions.security.nonce.NonceFactory;
-import org.jboss.ws.extensions.security.operation.AuthorizeOperation;
import org.jboss.ws.extensions.security.operation.DecryptionOperation;
import org.jboss.ws.extensions.security.operation.ReceiveUsernameOperation;
import org.jboss.ws.extensions.security.operation.ReceiveX509Certificate;
@@ -45,7 +45,6 @@
import org.jboss.ws.extensions.security.operation.SignatureVerificationOperation;
import org.jboss.ws.extensions.security.operation.TimestampVerificationOperation;
import org.jboss.ws.metadata.wsse.Authenticate;
-import org.jboss.ws.metadata.wsse.Authorize;
import org.jboss.ws.metadata.wsse.TimestampVerification;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -77,7 +76,16 @@
public SecurityDecoder(SecurityStore store, NonceFactory nonceFactory,
TimestampVerification timestampVerification, Authenticate authenticate)
{
- org.apache.xml.security.Init.init();
+ final ClassLoader origCL = SecurityActions.getContextClassLoader();
+ try
+ {
+ SecurityActions.setContextClassLoader(Init.class.getClassLoader());
+ Init.init();
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(origCL);
+ }
this.store = store;
this.nonceFactory = nonceFactory;
this.timestampVerification = timestampVerification;
Modified:
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityEncoder.java
===================================================================
---
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityEncoder.java 2011-03-08
18:45:04 UTC (rev 13871)
+++
stack/native/branches/ropalka/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityEncoder.java 2011-03-09
11:16:13 UTC (rev 13872)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.apache.xml.security.Init;
import org.jboss.ws.extensions.security.element.SecurityHeader;
import org.jboss.ws.extensions.security.exception.WSSecurityException;
import org.jboss.ws.extensions.security.operation.EncodingOperation;
@@ -43,7 +44,16 @@
public SecurityEncoder(List<EncodingOperation> operations, SecurityStore store)
{
- org.apache.xml.security.Init.init();
+ final ClassLoader origCL = SecurityActions.getContextClassLoader();
+ try
+ {
+ SecurityActions.setContextClassLoader(Init.class.getClassLoader());
+ Init.init();
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(origCL);
+ }
this.operations = operations;
this.store = store;
}