Author: asoldano
Date: 2014-02-03 12:02:53 -0500 (Mon, 03 Feb 2014)
New Revision: 18304
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
Log:
[JBWS-3756] Add permission checks to sensitive public static methods
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2014-02-03
17:00:22 UTC (rev 18303)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2014-02-03
17:02:53 UTC (rev 18304)
@@ -576,7 +576,7 @@
Client client = obj instanceof DispatchImpl<?> ?
((DispatchImpl<?>)obj).getClient() : ClientProxy.getClient(obj);
client.getOutInterceptors().add(new HandlerChainSortInterceptor(binding));
if (ClassLoaderProvider.isSet()) { //optimization for avoiding checking for a
server config when we know for sure we're out-of-container
- ServerConfig sc = AbstractServerConfig.getServerIntegrationServerConfig();
+ ServerConfig sc = getServerConfig();
if (sc != null) {
ClientConfig config =
sc.getClientConfig(ClientConfig.STANDARD_CLIENT_CONFIG);
if (config != null) {
@@ -594,6 +594,13 @@
}
}
}
+
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return
AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
}
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java 2014-02-03
17:00:22 UTC (rev 18303)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java 2014-02-03
17:02:53 UTC (rev 18304)
@@ -27,6 +27,7 @@
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
+import java.security.AccessController;
import java.util.Collection;
import java.util.regex.Pattern;
@@ -54,6 +55,7 @@
import org.jboss.wsf.spi.invocation.InvocationContext;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointMetrics;
+import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
import org.jboss.wsf.stack.cxf.configuration.BusHolder;
@@ -201,8 +203,7 @@
final String ctxUri = req.getRequestURI();
final String baseUri = req.getRequestURL().toString() + "?" +
queryString;
final EndpointInfo endpointInfo = dest.getEndpointInfo();
- final boolean autoRewrite = SoapAddressRewriteHelper.isAutoRewriteOn(
- AbstractServerConfig.getServerIntegrationServerConfig());
+ final boolean autoRewrite =
SoapAddressRewriteHelper.isAutoRewriteOn(getServerConfig());
endpointInfo.setProperty(WSDLGetUtils.AUTO_REWRITE_ADDRESS, autoRewrite);
endpointInfo.setProperty(WSDLGetUtils.AUTO_REWRITE_ADDRESS_ALL,
autoRewrite);
@@ -239,6 +240,13 @@
return false;
}
+
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return
AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
private long initRequestMetrics(Endpoint endpoint)
{
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2014-02-03
17:00:22 UTC (rev 18303)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2014-02-03
17:02:53 UTC (rev 18304)
@@ -22,6 +22,7 @@
package org.jboss.wsf.stack.cxf.configuration;
import java.io.IOException;
+import java.security.AccessController;
import java.util.List;
import org.apache.cxf.frontend.ServerFactoryBean;
@@ -134,7 +135,7 @@
if (configFile == null)
{
//use endpoint configs from AS domain
- ServerConfig sc = AbstractServerConfig.getServerIntegrationServerConfig();
+ ServerConfig sc = getServerConfig();
org.jboss.wsf.spi.metadata.config.EndpointConfig config =
sc.getEndpointConfig(configName);
if (config != null) {
endpoint.setEndpointConfig(config);
@@ -159,6 +160,13 @@
}
}
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return
AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+
public void setDeploymentRoot(UnifiedVirtualFile deploymentRoot)
{
this.deploymentRoot = deploymentRoot;
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-02-03
17:00:22 UTC (rev 18303)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-02-03
17:02:53 UTC (rev 18304)
@@ -25,6 +25,7 @@
import static org.jboss.wsf.stack.cxf.Messages.MESSAGES;
import java.net.URL;
+import java.security.AccessController;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -282,7 +283,7 @@
if (wsdlLocation == null) {
wsdlLocation = ddep.getAnnotationWsdlLocation();
}
- final ServerConfig sc = AbstractServerConfig.getServerIntegrationServerConfig();
+ final ServerConfig sc = getServerConfig();
if (wsdlLocation != null) {
URL wsdlUrl = dep.getResourceResolver().resolveFailSafe(wsdlLocation);
if (wsdlUrl != null) {
@@ -320,6 +321,13 @@
}
}
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return
AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+
/**
* Extracts the typeNS given the package name
* Algorithm is based on the one specified in JAXWS v2.0 spec