You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/06/12 08:11:34 UTC
svn commit: r413587 - in /webservices/axis2/trunk/java/modules:
codegen/src/org/apache/axis2/wsdl/codegen/
codegen/src/org/apache/axis2/wsdl/codegen/emitter/
codegen/src/org/apache/axis2/wsdl/codegen/extension/
codegen/src/org/apache/axis2/wsdl/templat...
Author: sanka
Date: Sun Jun 11 23:11:33 2006
New Revision: 413587
URL: http://svn.apache.org/viewvc?rev=413587&view=rev
Log:
I've updated the policyExtensionTemplate and few other classes to support WSSecurity policies at the client-side. Now we can keep on updating it until we get the full WSSecurity policy support.
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/PolicyExtensionTemplate.xsl
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/Rampart.java
webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllReceiver.java
webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?rev=413587&r1=413586&r2=413587&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties Sun Jun 11 23:11:33 2006
@@ -6,7 +6,7 @@
# these are loaded in their lexical order
# Note the last extension - It includes a check to figure out whether proper databinding has taken place
# This extension should appear AFTER all the databinding extensions inorder to function properly
-codegen.extension=org.apache.axis2.wsdl.codegen.extension.JaxMeExtension,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.JiBXExtension,org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension,org.apache.axis2.wsdl.codegen.extension.TypeMapperExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension
+codegen.extension=org.apache.axis2.wsdl.codegen.extension.JaxMeExtension,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.JiBXExtension,org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension,org.apache.axis2.wsdl.codegen.extension.TypeMapperExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension,org.apache.axis2.wsdl.codegen.extension.PolicyEvaluator
#extensions that work after the main emitter. These will include functionality such as
#formatters
post.codegen.extension=org.apache.axis2.wsdl.codegen.extension.JavaPrettyPrinterExtension,org.apache.axis2.wsdl.codegen.extension.XMLPrettyPrinterExtension,org.apache.axis2.wsdl.codegen.extension.WSDLPrettyPrinterExtension
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=413587&r1=413586&r2=413587&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Sun Jun 11 23:11:33 2006
@@ -454,12 +454,12 @@
// the stubs implementation and not visible outside
rootElement.appendChild(createDOMElementforDatabinders(doc));
- Object stubMethods;
+ Object moduleCodegenPolicyExtensionElement;
//if some extension has added the stub methods property, add them to the
//main document
- if ((stubMethods = codeGenConfiguration.getProperty("stubMethods")) != null) {
- rootElement.appendChild(doc.importNode((Element) stubMethods, true));
+ if ((moduleCodegenPolicyExtensionElement = codeGenConfiguration.getProperty("module-codegen-policy-extensions")) != null) {
+ rootElement.appendChild(doc.importNode((Element) moduleCodegenPolicyExtensionElement, true));
}
//add another element to have the unique list of faults
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java?rev=413587&r1=413586&r2=413587&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java Sun Jun 11 23:11:33 2006
@@ -107,7 +107,7 @@
init(configuration);
Document document = getEmptyDocument();
- Element rootElement = document.createElement("stubMethods");
+ Element rootElement = document.createElement("module-codegen-policy-extensions");
AxisOperation axisOperation;
QName opName;
@@ -127,7 +127,7 @@
}
}
- configuration.putProperty("stubMethods", rootElement);
+ configuration.putProperty("module-codegen-policy-extensions", rootElement);
}
private void processPolicies(Document document, Element rootElement,
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/PolicyExtensionTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/PolicyExtensionTemplate.xsl?rev=413587&r1=413586&r2=413587&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/PolicyExtensionTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/PolicyExtensionTemplate.xsl Sun Jun 11 23:11:33 2006
@@ -1,8 +1,8 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:template match="stubMethods">
-
+ <xsl:template match="module-codegen-policy-extensions">
+
<xsl:if test="//createSequence">
/**
* Starts a reliabel message sequence
@@ -33,9 +33,77 @@
<xsl:variable name="optimized">
<xsl:value-of select="//optimizeContent"/>
</xsl:variable>
+
+
+ <xsl:if test="//security-codegen-policy-extensions/usernametoken-action">
+ // auto genenrated stub methods
+
+ public void setUsername(String username) {
+ _serviceClient.getOptions().setProperty(org.apache.ws.security.handler.WSHandlerConstants.USER, username);
+ }
+
+ public void setPassword(String password) {
+ _UTCallback pwCallback = new _UTCallback();
+ pwCallback.setPassword(password);
+ _serviceClient
+ .getOptions()
+ .setProperty(
+ org.apache.ws.security.handler.WSHandlerConstants.PASSWORD_TYPE,
+ "PasswordText");
+ _serviceClient
+ .getOptions()
+ .setProperty(
+ org.apache.ws.security.handler.WSHandlerConstants.PW_CALLBACK_REF,
+ pwCallback); }
+
+ private class _UTCallback implements
+ javax.security.auth.callback.CallbackHandler {
+
+ private String password;
+
+ public _UTCallback() {
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public void handle(javax.security.auth.callback.Callback[] callbacks)
+
+ throws java.io.IOException,
+ javax.security.auth.callback.UnsupportedCallbackException {
+
+ for (int i = 0; i < callbacks.length; i++) {
+
+ if (callbacks[i] instanceof org.apache.ws.security.WSPasswordCallback) {
+
+ org.apache.ws.security.WSPasswordCallback pc = (org.apache.ws.security.WSPasswordCallback) callbacks[i];
+
+ if (pc.getIdentifer().equals(getUsername())) {
+ pc.setPassword(password);
+
+ } else {
+ pc.setPassword(password);
+ }
+
+ } else {
+
+ throw new javax.security.auth.callback.UnsupportedCallbackException(
+ callbacks[i], "Unrecognized Callback");
+ }
+ }
+ }
+
+ private String getUsername() {
+ return (String) _serviceClient.getOptions().getProperty(
+ org.apache.ws.security.handler.WSHandlerConstants.USER);
+ }
+ }
+ </xsl:if>
+
- <xsl:choose>
- <xsl:when test="$optimized">
+ <xsl:choose>
+ <xsl:when test="$optimized">
private void setOpNameArray(){
opNameArray = new javax.xml.namespace.QName[] {
<xsl:for-each select="optimizeContent/opName">
@@ -45,11 +113,11 @@
};
}
</xsl:when>
- <xsl:otherwise>
+ <xsl:otherwise>
private void setOpNameArray(){
opNameArray = null;
}
</xsl:otherwise>
- </xsl:choose>
-</xsl:template>
+ </xsl:choose>
+ </xsl:template>
</xsl:stylesheet>
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java?rev=413587&r1=413586&r2=413587&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java Sun Jun 11 23:11:33 2006
@@ -17,6 +17,12 @@
package org.apache.axis2.transport.http;
+import java.io.File;
+import java.io.IOException;
+import java.net.SocketException;
+
+import javax.xml.namespace.QName;
+
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
@@ -30,14 +36,8 @@
import org.apache.axis2.transport.http.server.HttpUtils;
import org.apache.axis2.transport.http.server.SimpleHttpServer;
import org.apache.axis2.util.OptionsParser;
-import org.apache.axis2.util.threadpool.ThreadFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.io.IOException;
-import java.net.SocketException;
/**
* This is a simple implementation of an HTTP server for processing
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/Rampart.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/Rampart.java?rev=413587&r1=413586&r2=413587&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/Rampart.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/Rampart.java Sun Jun 11 23:11:33 2006
@@ -21,8 +21,11 @@
import org.apache.axis2.description.AxisDescription;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.modules.Module;
+import org.apache.axis2.modules.ModulePolicyExtension;
+import org.apache.axis2.modules.PolicyExtension;
import org.apache.rampart.util.HandlerParameterDecoder;
import org.apache.rampart.handler.WSSHandlerConstants;
import org.apache.rampart.handler.config.InflowConfiguration;
@@ -30,9 +33,10 @@
import org.apache.ws.policy.Policy;
import org.apache.ws.security.policy.WSS4JConfig;
import org.apache.ws.security.policy.WSS4JConfigBuilder;
+import org.apache.ws.security.policy.extension.WSSCodegenPolicyExtension;
import org.apache.ws.security.policy.parser.WSSPolicyProcessor;
-public class Rampart implements Module {
+public class Rampart implements Module, ModulePolicyExtension {
private AxisModule module;
public void init(ConfigurationContext configContext, AxisModule module)
@@ -73,7 +77,7 @@
WSS4JConfig clientConfig = WSS4JConfigBuilder
.build(wssPolicyProcessor.getRootPED()
- .getTopLevelPEDs(),false);
+ .getTopLevelPEDs(), isServerSide(axisDescription));
policyInflowConfig = clientConfig.getInflowConfiguration();
@@ -95,6 +99,10 @@
// Do nothing
}
+ public PolicyExtension getPolicyExtension() {
+ return new WSSCodegenPolicyExtension();
+ }
+
private InflowConfiguration calcuateCurrentInflowConfiguration(
InflowConfiguration policyInflowConfig,
AxisDescription axisDescription) throws AxisFault {
@@ -183,4 +191,20 @@
}
return secondryConf;
}
+
+ private boolean isServerSide(AxisDescription axisDescription) {
+
+ if (axisDescription instanceof AxisService) {
+ return !((AxisService) axisDescription).isClientSide();
+
+ } else if (axisDescription instanceof AxisOperation) {
+ return !((AxisService) axisDescription.getParent()).isClientSide();
+
+ } else {
+ // we assume that the default is the client-side
+ return false;
+ }
+ }
+
+
}
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllReceiver.java?rev=413587&r1=413586&r2=413587&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllReceiver.java Sun Jun 11 23:11:33 2006
@@ -93,12 +93,13 @@
//Figureout if the handler should run
Object inFlowSecurity = null;
- if((inFlowSecurity = getOption(WSSHandlerConstants.INFLOW_SECURITY)) == null) {
- inFlowSecurity = getProperty(msgContext, WSSHandlerConstants.INFLOW_SECURITY);
- }
-
- if(inFlowSecurity == null) {
+ if((inFlowSecurity = getOption(WSSHandlerConstants.INFLOW_SECURITY)) == null &&
+ (inFlowSecurity = getProperty(msgContext, WSSHandlerConstants.INFLOW_SECURITY)) == null &&
+ (inFlowSecurity = getOption(WSSHandlerConstants.INFLOW_SECURITY_CLIENT)) == null &&
+ (inFlowSecurity = getProperty(msgContext, WSSHandlerConstants.INFLOW_SECURITY_CLIENT)) == null &&
+ (inFlowSecurity = getOption(WSSHandlerConstants.INFLOW_SECURITY_SERVER)) == null &&
+ (inFlowSecurity = getProperty(msgContext, WSSHandlerConstants.INFLOW_SECURITY_SERVER)) == null) {
return;
}
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java?rev=413587&r1=413586&r2=413587&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java Sun Jun 11 23:11:33 2006
@@ -99,14 +99,16 @@
//Figureout if the handler should run
Object outFlowSecurity;
- if((outFlowSecurity = getOption(WSSHandlerConstants.OUTFLOW_SECURITY)) == null) {
- outFlowSecurity = getProperty(msgContext, WSSHandlerConstants.OUTFLOW_SECURITY);
- }
-
- if(outFlowSecurity == null) {
- return;
- }
-
+ if((outFlowSecurity = getOption(WSSHandlerConstants.OUTFLOW_SECURITY)) == null &&
+ (outFlowSecurity = getProperty(msgContext, WSSHandlerConstants.OUTFLOW_SECURITY)) == null &&
+ (outFlowSecurity = getOption(WSSHandlerConstants.OUTFLOW_SECURITY_CLIENT)) == null &&
+ (outFlowSecurity = getProperty(msgContext, WSSHandlerConstants.OUTFLOW_SECURITY_CLIENT)) == null &&
+ (outFlowSecurity = getOption(WSSHandlerConstants.OUTFLOW_SECURITY_SERVER)) == null &&
+ (outFlowSecurity = getProperty(msgContext, WSSHandlerConstants.OUTFLOW_SECURITY_SERVER)) == null)
+
+ {
+ return;
+ }
Vector actions = new Vector();
String action = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org