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 ru...@apache.org on 2006/06/22 15:41:12 UTC
svn commit: r416368 - in /webservices/axis2/trunk/java: etc/
modules/integration/ modules/integration/test-resources/rahas/
modules/integration/test/org/apache/rahas/ modules/rahas/src/META-INF/
modules/rahas/src/org/apache/rahas/ modules/rahas/src/org...
Author: ruchithf
Date: Thu Jun 22 06:41:11 2006
New Revision: 416368
URL: http://svn.apache.org/viewvc?rev=416368&view=rev
Log:
- Added a simple SAML issuer
- Added a rahas (WS-Trust) integration test case to use the SAMLTokenIssuer
- Changed the opensaml version to 1.1
- Added a repo location to etc/project.properties to download opensaml-1.1.jar
- Added skip.enteprise.tests check into integration maven.xml to be able to
skip the entrprise.wsdl codegen tests. (Saves time in debugging integration testcases)
Added:
webservices/axis2/trunk/java/modules/integration/test-resources/rahas/
webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml
webservices/axis2/trunk/java/modules/integration/test-resources/rahas/samlIssuer.properties (with props)
webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sctIssuer.properties (with props)
webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sts.jks (with props)
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/PWCallback.java (with props)
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahsSAMLTokenTest.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/Service.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java
Modified:
webservices/axis2/trunk/java/etc/project.properties
webservices/axis2/trunk/java/modules/integration/maven.xml
webservices/axis2/trunk/java/modules/integration/project.properties
webservices/axis2/trunk/java/modules/integration/project.xml
webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties
webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java
webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSSHandlerConstants.java
Modified: webservices/axis2/trunk/java/etc/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/etc/project.properties?rev=416368&r1=416367&r2=416368&view=diff
==============================================================================
--- webservices/axis2/trunk/java/etc/project.properties (original)
+++ webservices/axis2/trunk/java/etc/project.properties Thu Jun 22 06:41:11 2006
@@ -36,7 +36,8 @@
http://people.apache.org/repository/,\
http://www.apache.org/dist/java-repository/,\
http://mirrors.sunsite.dk/maven/,\
-http://jibx.sourceforge.net/maven/
+http://jibx.sourceforge.net/maven/,\
+http://developer.ja-sig.org/maven/
@@ -114,7 +115,7 @@
jibx.version=1.1-beta3
junit.version=3.8.1
maven.itest.plugin.version=1.0
-opensaml.version=1.0.1
+opensaml.version=1.1
neethi.version=SNAPSHOT
servletapi.version=2.3
spring.version=1.2.6
@@ -133,7 +134,7 @@
XmlSchema.version=1.0.2
xmlsec.version=1.3.0
xmlunit.version=1.0
-
+log4j.version=1.2.13
# ------------------------------------------------------------------------
# M A V E N J A R O V E R R I D E
# ------------------------------------------------------------------------
Modified: webservices/axis2/trunk/java/modules/integration/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/maven.xml?rev=416368&r1=416367&r2=416368&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/maven.xml Thu Jun 22 06:41:11 2006
@@ -76,6 +76,7 @@
</java>
<j:if test="${context.getVariable('maven.test.skip') != 'true'}">
+ <j:if test="${context.getVariable('skip.enterprise.tests') != 'true'}">
<!-- codegen for the enterprise wsdl -->
<ant:echo>Running codegen for Enterprise WSDL - take 1</ant:echo>
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
@@ -109,6 +110,7 @@
</java>
<ant:ant antfile="build.xml" inheritall="true" inheritrefs="true" dir="target/enterprise-test4"
target="jar.server"/>
+ </j:if>
</j:if>
</preGoal>
@@ -145,7 +147,7 @@
<!-- SecConv Test - 1 -->
- <mkdir dir="target/test-resources/sc/_service_repo_1"/>
+ <mkdir dir="target/test-resources/sc_service_repo_1"/>
<mkdir dir="target/test-resources/sc_service_repo_1/conf"/>
<mkdir dir="target/test-resources/sc_service_repo_1/services"/>
<mkdir dir="target/test-resources/sc_service_repo_1/modules"/>
@@ -165,9 +167,9 @@
<jar jarfile="target/test-resources/sc_service_repo_1/services/SecureService.aar"
basedir="target/temp-sc"/>
- <!-- Rahas Test - 1 :END -->
+ <!-- SecConv Test - 1 :END -->
- <!-- Rahas Test - 2 -->
+ <!-- SecConv Test - 2 -->
<mkdir dir="target/test-resources/sc_service_repo_2"/>
<mkdir dir="target/test-resources/sc_service_repo_2/conf"/>
@@ -188,9 +190,9 @@
<jar overwrite="yes" jarfile="target/test-resources/sc_service_repo_2/services/SecureService.aar"
basedir="target/temp-sc"/>
- <!-- Rahas Test - 2 :END -->
+ <!-- SecConv Test - 2 :END -->
- <!-- Rahas Test - 3 -->
+ <!-- SecConv Test - 3 -->
<mkdir dir="target/test-resources/sc_service_repo_3"/>
<mkdir dir="target/test-resources/sc_service_repo_3/conf"/>
@@ -208,9 +210,9 @@
<jar overwrite="yes" jarfile="target/test-resources/sc_service_repo_3/services/SecureService.aar"
basedir="target/temp-sc"/>
- <!-- Rahas Test - 3 :END -->
+ <!-- SecConv Test - 3 :END -->
- <!-- Rahas Test - 4 -->
+ <!-- SecConv Test - 4 -->
<mkdir dir="target/test-resources/sc_service_repo_4"/>
<mkdir dir="target/test-resources/sc_service_repo_4/conf"/>
@@ -231,10 +233,77 @@
<jar overwrite="yes" jarfile="target/test-resources/sc_service_repo_4/services/SecureService.aar"
basedir="target/temp-sc"/>
- <!-- Rahas Test - 4 :END -->
+ <!-- SecConv Test - 4 :END -->
<!-- clean up temp sc stuff -->
<delete dir="target/temp-sc"/>
+
+ <!-- Set up the infra for rahas tests and the rahas client repo -->
+
+ <mkdir dir="target/temp-rahas"/>
+ <mkdir dir="target/temp-rahas/META-INF"/>
+
+ <copy overwrite="yes" file="target/test-classes/org/apache/rahas/Service.class"
+ tofile="target/temp-rahas/org/apache/rahas/Service.class"/>
+ <copy overwrite="yes" file="target/test-classes/org/apache/rahas/PWCallback.class"
+ tofile="target/temp-sc/org/apache/rahas/PWCallback.class"/>
+
+ <copy overwrite="yes" todir="target/temp-rahas">
+ <fileset dir="test-resources/rahas">
+ <include name="sctIssuer.properties"/>
+ <include name="sts.jks"/>
+ </fileset>
+ </copy>
+
+ <ant:path id="rahas.client.props" location="test-resources/rahas"/>
+ <maven:addPath id="maven.dependency.classpath" refid="rahas.client.props"/>
+
+ <mkdir dir="target/test-resources/rahas_client_repo"/>
+ <mkdir dir="target/test-resources/rahas_client_repo/conf"/>
+ <mkdir dir="target/test-resources/rahas_client_repo/modules"/>
+
+ <copy file="../addressing/target/addressing-${addressing_version}.mar"
+ tofile="target/test-resources/rahas_client_repo/modules/addressing-${addressing_version}.mar"/>
+ <copy file="../security/target/rampart-${rampart_version}.mar"
+ tofile="target/test-resources/rahas_client_repo/modules/rampart-${rampart_version}.mar"/>
+
+ <!-- Copying the DOM3 stuff to the endorsed dir -->
+ <mkdir dir="target/test-resources/endorsed"/>
+ <j:if test="${context.getVariable('maven.jar.override').toString().trim().equalsIgnoreCase('on')}">
+ <copy file="${dependencies.dir}/xercesImpl-${xerces.version}.jar"
+ todir="target/test-resources/endorsed"/>
+ <copy file="${dependencies.dir}/xml-apis-${xml_apis.version}.jar"
+ todir="target/test-resources/endorsed"/>
+ </j:if>
+ <j:if test="${context.getVariable('maven.jar.override').toString().trim().equalsIgnoreCase('off')}">
+ <copy file="${maven.repo.local}/xerces/jars/xercesImpl-${xerces.version}.jar"
+ todir="target/test-resources/endorsed"/>
+ <copy file="${maven.repo.local}/xml-apis/jars/xml-apis-${xml_apis.version}.jar"
+ todir="target/test-resources/endorsed"/>
+ </j:if>
+
+ <!-- Rahas Test1: SAML Token test -->
+ <mkdir dir="target/test-resources/rahas_service_repo_1"/>
+ <mkdir dir="target/test-resources/rahas_service_repo_1/conf"/>
+ <mkdir dir="target/test-resources/rahas_service_repo_1/services"/>
+ <mkdir dir="target/test-resources/rahas_service_repo_1/modules"/>
+
+ <copy file="../security/target/rampart-${rampart_version}.mar"
+ tofile="target/test-resources/rahas_service_repo_1/modules/rampart-${rampart_version}.mar"/>
+ <copy file="../rahas/target/rahas-${rahas_version}.mar"
+ tofile="target/test-resources/rahas_service_repo_1/modules/rahas-${rahas_version}.mar"/>
+ <copy file="../addressing/target/addressing-${addressing_version}.mar"
+ tofile="target/test-resources/rahas_service_repo_1/modules/addressing-${addressing_version}.mar"/>
+
+
+ <!-- copy the services.xml and create the aar -->
+ <copy overwrite="yes" file="test-resources/rahas/s1-services.xml"
+ tofile="target/temp-rahas/META-INF/services.xml"/>
+
+ <jar overwrite="yes" jarfile="target/test-resources/rahas_service_repo_1/services/SecureService.aar"
+ basedir="target/temp-rahas"/>
+
+ <!-- Rahas Test1: SAML Token test : END -->
<mkdir dir="target/test-resources/samples/modules"/>
@@ -609,23 +678,6 @@
<!-- Create the .aar file -->
<jar jarfile="target/test-resources/scenario7_service_repo/services/PingPort.aar"
basedir="../security/target/interop/classes"/>
-
-
- <!-- Copying the DOM3 stuff to the endorsed dir -->
- <mkdir dir="target/test-resources/endorsed"/>
- <j:if test="${context.getVariable('maven.jar.override').toString().trim().equalsIgnoreCase('on')}">
- <copy file="${dependencies.dir}/xercesImpl-${xerces.version}.jar"
- todir="target/test-resources/endorsed"/>
- <copy file="${dependencies.dir}/xml-apis-${xml_apis.version}.jar"
- todir="target/test-resources/endorsed"/>
- </j:if>
- <j:if test="${context.getVariable('maven.jar.override').toString().trim().equalsIgnoreCase('off')}">
- <copy file="${maven.repo.local}/xerces/jars/xercesImpl-${xerces.version}.jar"
- todir="target/test-resources/endorsed"/>
- <copy file="${maven.repo.local}/xml-apis/jars/xml-apis-${xml_apis.version}.jar"
- todir="target/test-resources/endorsed"/>
- </j:if>
-
<!-- Scenario ST1 -->
<mkdir dir="target/test-resources/scenarioST1_client_repo"/>
Modified: webservices/axis2/trunk/java/modules/integration/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/project.properties?rev=416368&r1=416367&r2=416368&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/project.properties (original)
+++ webservices/axis2/trunk/java/modules/integration/project.properties Thu Jun 22 06:41:11 2006
@@ -30,6 +30,8 @@
#maven.itest.exclude=org/apache/axis2/interop/whitemesa/round2/**/*.java
maven.junit.fork=true
+maven.junit.jvmargs=-Djava.endorsed.dirs=target/test-resources/endorsed
+
maven.test.search.classdir=true
maven.itest.resources=itestConfig
Modified: webservices/axis2/trunk/java/modules/integration/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/project.xml?rev=416368&r1=416367&r2=416368&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/project.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/project.xml Thu Jun 22 06:41:11 2006
@@ -330,6 +330,12 @@
<module>true</module>
</properties>
</dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+
</dependencies>
Added: webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml?rev=416368&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml Thu Jun 22 06:41:11 2006
@@ -0,0 +1,30 @@
+<service name="SecureService">
+
+ <module ref="rampart"/>
+ <module ref="rahas"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.axis2.security.sc.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <parameter name="sct-issuer-config">
+ <sct-issuer-config>
+ <proofToken>EncryptedKey</proofToken>
+ <cryptoProperties>sctIssuer.properties</cryptoProperties>
+ <addRequestedAttachedRef />
+ </sct-issuer-config>
+ </parameter>
+
+ <parameter xmlns="" name="sc-configuration">
+ <sc-configuration xmlns="">
+ <scope xmlns="">service</scope>
+ <passwordCallbackClass xmlns="">org.apache.axis2.security.sc.PWCallback</passwordCallbackClass>
+ <cryptoProperties xmlns="">sctIssuer.properties</cryptoProperties>
+ </sc-configuration>
+ </parameter>
+
+
+</service>
Added: webservices/axis2/trunk/java/modules/integration/test-resources/rahas/samlIssuer.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/rahas/samlIssuer.properties?rev=416368&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/rahas/samlIssuer.properties (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/rahas/samlIssuer.properties Thu Jun 22 06:41:11 2006
@@ -0,0 +1,4 @@
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=password
+org.apache.ws.security.crypto.merlin.file=sts.jks
Propchange: webservices/axis2/trunk/java/modules/integration/test-resources/rahas/samlIssuer.properties
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sctIssuer.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sctIssuer.properties?rev=416368&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sctIssuer.properties (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sctIssuer.properties Thu Jun 22 06:41:11 2006
@@ -0,0 +1,4 @@
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=password
+org.apache.ws.security.crypto.merlin.file=sts.jks
Propchange: webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sctIssuer.properties
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sts.jks
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sts.jks?rev=416368&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis2/trunk/java/modules/integration/test-resources/rahas/sts.jks
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/PWCallback.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/PWCallback.java?rev=416368&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/PWCallback.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/PWCallback.java Thu Jun 22 06:41:11 2006
@@ -0,0 +1,187 @@
+package org.apache.rahas;
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import org.apache.ws.security.WSPasswordCallback;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import java.io.IOException;
+
+
+
+/**
+
+ * Class PWCallback
+
+ */
+
+public class PWCallback implements CallbackHandler {
+
+
+
+ /** Field key */
+
+ private static final byte[] key = {
+
+ (byte) 0x31, (byte) 0xfd, (byte) 0xcb, (byte) 0xda, (byte) 0xfb,
+
+ (byte) 0xcd, (byte) 0x6b, (byte) 0xa8, (byte) 0xe6, (byte) 0x19,
+
+ (byte) 0xa7, (byte) 0xbf, (byte) 0x51, (byte) 0xf7, (byte) 0xc7,
+
+ (byte) 0x3e, (byte) 0x80, (byte) 0xae, (byte) 0x98, (byte) 0x51,
+
+ (byte) 0xc8, (byte) 0x51, (byte) 0x34, (byte) 0x04,
+
+ };
+
+
+
+ /*
+
+ * (non-Javadoc)
+
+ * @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
+
+ */
+
+
+
+ /**
+
+ * Method handle
+
+ *
+
+ * @param callbacks
+
+ * @throws java.io.IOException
+
+ * @throws javax.security.auth.callback.UnsupportedCallbackException
+
+ */
+
+ public void handle(Callback[] callbacks)
+
+ throws IOException, UnsupportedCallbackException {
+
+
+
+ for (int i = 0; i < callbacks.length; i++) {
+
+ if (callbacks[i] instanceof WSPasswordCallback) {
+
+ WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
+
+
+
+ /*
+
+ * This usage type is used only in case we received a
+
+ * username token with a password of type PasswordText or
+
+ * an unknown password type.
+
+ *
+
+ * This case the WSPasswordCallback object contains the
+
+ * identifier (aka username), the password we received, and
+
+ * the password type string to identify the type.
+
+ *
+
+ * Here we perform only a very simple check.
+
+ */
+
+ if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN) {
+
+ if(pc.getIdentifer().equals("Ron") && pc.getPassword().equals("noR")) {
+
+ return;
+
+ }
+
+ if (pc.getPassword().equals("sirhC")) {
+
+ return;
+
+ }
+
+ throw new UnsupportedCallbackException(callbacks[i],
+
+ "check failed");
+
+ }
+
+ /*
+
+ * here call a function/method to lookup the password for
+
+ * the given identifier (e.g. a user name or keystore alias)
+
+ * e.g.: pc.setPassword(passStore.getPassword(pc.getIdentfifier))
+
+ * for Testing we supply a fixed name here.
+
+ */
+
+ if (pc.getUsage() == WSPasswordCallback.KEY_NAME) {
+
+ pc.setKey(key);
+
+ } else if(pc.getIdentifer().equals("alice")) {
+
+ pc.setPassword("password");
+
+ } else if(pc.getIdentifer().equals("bob")) {
+
+ pc.setPassword("password");
+
+ } else if(pc.getIdentifer().equals("Ron")) {
+
+ pc.setPassword("noR");
+
+ } else if(pc.getIdentifer().equals("sts")) {
+
+ pc.setPassword("password");
+
+ } else {
+
+ pc.setPassword("sirhC");
+
+ }
+
+ } else {
+
+ throw new UnsupportedCallbackException(callbacks[i],
+
+ "Unrecognized Callback");
+
+ }
+
+ }
+
+ }
+
+}
+
+
Propchange: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/PWCallback.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahsSAMLTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahsSAMLTokenTest.java?rev=416368&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahsSAMLTokenTest.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahsSAMLTokenTest.java Thu Jun 22 06:41:11 2006
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rahas;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axis2.databinding.types.URI;
+import org.apache.axis2.util.StreamWrapper;
+import org.apache.rahas.types.RequestSecurityTokenType;
+import org.apache.rampart.handler.config.InflowConfiguration;
+import org.apache.rampart.handler.config.OutflowConfiguration;
+import org.apache.rampart.util.Axis2Util;
+import org.opensaml.SAMLAssertion;
+import org.opensaml.XML;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * @author Ruchith Fernando (ruchith.fernando@gmail.com)
+ */
+public class RahsSAMLTokenTest extends TestClient {
+
+
+ /**
+ * @param name
+ */
+ public RahsSAMLTokenTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.rahas.TestClient#getClientOutflowConfiguration()
+ */
+ public OutflowConfiguration getClientOutflowConfiguration() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.rahas.TestClient#getClientInflowConfiguration()
+ */
+ public InflowConfiguration getClientInflowConfiguration() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.rahas.TestClient#getServiceRepo()
+ */
+ public String getServiceRepo() {
+ return "rahas_service_repo_1";
+ }
+
+ public OMElement getRequest() {
+
+ RequestSecurityTokenType rst = new RequestSecurityTokenType();
+ try {
+ rst.setRequestType(new URI(org.apache.rahas.Constants.REQ_TYPE_ISSUE));
+ rst.setTokenType(new URI(org.apache.rahas.Constants.TOK_TYPE_SAML_10));
+ rst.setContext(new URI("http://get.optional.attrs.working"));
+
+ Axis2Util.useDOOM(false);
+ StAXOMBuilder builder = new StAXOMBuilder(new StreamWrapper(rst
+ .getPullParser(new QName(org.apache.rahas.Constants.WST_NS,
+ org.apache.rahas.Constants.REQUEST_SECURITY_TOKEN_LN))));
+
+ OMElement rstElem = builder.getDocumentElement();
+
+ rstElem.build();
+ rstElem = (OMElement)rstElem.detach();
+ return rstElem;
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void validateRsponse(OMElement resp) {
+ System.out.println(resp);
+ OMElement elem = resp.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+ assertNotNull("Missing SAML Assertoin", elem);
+ }
+
+
+}
Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/Service.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/Service.java?rev=416368&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/Service.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/Service.java Thu Jun 22 06:41:11 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rahas;
+import org.apache.axiom.om.OMElement;
+
+public class Service {
+
+ public OMElement echo(OMElement elem) {
+ elem.build();
+ elem.detach();
+ System.out.println("Service invoked");
+ return elem;
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java?rev=416368&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java Thu Jun 22 06:41:11 2006
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rahas;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.databinding.types.URI;
+import org.apache.axis2.integration.UtilServer;
+import org.apache.axis2.util.StreamWrapper;
+import org.apache.rahas.types.RequestSecurityTokenType;
+import org.apache.rampart.handler.WSSHandlerConstants;
+import org.apache.rampart.handler.config.InflowConfiguration;
+import org.apache.rampart.handler.config.OutflowConfiguration;
+import org.apache.rampart.util.Axis2Util;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+public abstract class TestClient extends TestCase {
+
+ protected int port = UtilServer.TESTING_PORT;
+
+ public TestClient(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ UtilServer.start(Constants.TESTING_PATH + getServiceRepo() ,null);
+ }
+
+ protected void tearDown() throws Exception {
+ UtilServer.stop();
+ }
+
+ /**
+ * @param args
+ */
+ public void testConversation() {
+ try {
+
+ // Get the repository location from the args
+ String repo = Constants.TESTING_PATH + "rahas_client_repo";
+
+ OMElement payload = getRequest();
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repo,
+ null);
+ ServiceClient serviceClient = new ServiceClient(configContext, null);
+ Options options = new Options();
+ options.setTo(new EndpointReference("http://127.0.0.1:" + port + "/axis2/services/SecureService"));
+ options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ options.setAction(org.apache.rahas.Constants.RST_ACTON_SCT);
+
+
+
+ OutflowConfiguration clientOutflowConfiguration = getClientOutflowConfiguration();
+ if(clientOutflowConfiguration != null) {
+ options.setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, clientOutflowConfiguration.getProperty());
+ }
+ InflowConfiguration clientInflowConfiguration = getClientInflowConfiguration();
+ if(clientInflowConfiguration != null) {
+ options.setProperty(WSSHandlerConstants.INFLOW_SECURITY, clientInflowConfiguration.getProperty());
+ }
+
+ serviceClient.engageModule(new QName("rampart"));
+
+ serviceClient.setOptions(options);
+
+ //Blocking invocation
+ serviceClient.sendReceive(payload);
+
+ serviceClient.sendReceive(getRequest());
+
+ OMElement result = serviceClient.sendReceive(getRequest());
+
+ this.validateRsponse(result);
+ } catch (AxisFault axisFault) {
+ axisFault.printStackTrace();
+ fail(axisFault.getMessage());
+ }
+ }
+
+ public abstract OMElement getRequest();
+
+ public abstract OutflowConfiguration getClientOutflowConfiguration();
+
+ public abstract InflowConfiguration getClientInflowConfiguration();
+
+ public abstract String getServiceRepo();
+
+ public abstract void validateRsponse(OMElement resp);
+}
Modified: webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml?rev=416368&r1=416367&r2=416368&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml Thu Jun 22 06:41:11 2006
@@ -20,6 +20,9 @@
<configuration-param>sct-issuer-config</configuration-param>
<tokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</tokenType>
</issuer>
+ <issuer class="org.apache.rahas.impl.SAMLTokenIssuer">
+ <tokenType>urn:oasis:names:tc:SAML:1.0:assertion</tokenType>
+ </issuer>
</token-dispatcher-configuration>
</parameter>
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java?rev=416368&r1=416367&r2=416368&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java Thu Jun 22 06:41:11 2006
@@ -41,6 +41,8 @@
//Token types
public final static String TOK_TYPE_SCT = "http://schemas.xmlsoap.org/ws/2005/02/sc/sct";
+ public final static String TOK_TYPE_SAML_10="urn:oasis:names:tc:SAML:1.0:assertion";
+
//RST actions
public final static String RST_ACTON_ISSUE = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue";
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java?rev=416368&r1=416367&r2=416368&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java Thu Jun 22 06:41:11 2006
@@ -73,8 +73,10 @@
//Use the first default issuer as the default isser
if(conf.defaultIssuerClassName == null) {
conf.defaultIssuerClassName = issuerClass;
+ } else {
+ throw new TrustException("badDispatcherConfigMultipleDefaultIssuers");
}
- }
+ }
//Process configuration file information
OMElement issuerConfigFileElement = element.getFirstChildWithName(CONFIGURATION_FILE);
@@ -110,7 +112,7 @@
}
//If the token type is not aleady declared then add it to the
//table with the issuer classname
- if(conf.issuers.keySet().size() > 0 && !conf.issuers.keySet().contains(value)) {
+ if(!conf.issuers.keySet().contains(value)) {
conf.issuers.put(value, issuerClass);
}
}
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties?rev=416368&r1=416367&r2=416368&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties Thu Jun 22 06:41:11 2006
@@ -27,4 +27,6 @@
reqestedSecTokMissing = RequestedSecurityToken missing in the response
rptMissing = RequestedProofToken missing in the response
notSupported = Not supported: {0}
-errorCreatingSymmKey = Error in creating the ephemeral key
\ No newline at end of file
+errorCreatingSymmKey = Error in creating the ephemeral key
+samlConverstionError = Error in converting a SAML token to DOOM
+badDispatcherConfigMultipleDefaultIssuers = Dispatcher configuration error : There should be only one default issuer
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java?rev=416368&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java (added)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java Thu Jun 22 06:41:11 2006
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rahas.impl;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
+import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.context.MessageContext;
+import org.apache.rahas.Constants;
+import org.apache.rahas.TokenIssuer;
+import org.apache.rahas.TrustException;
+import org.apache.rahas.TrustUtil;
+import org.apache.ws.security.components.crypto.Crypto;
+import org.apache.ws.security.components.crypto.CryptoFactory;
+import org.apache.ws.security.saml.SAMLIssuer;
+import org.apache.ws.security.saml.SAMLIssuerFactory;
+import org.opensaml.SAMLAssertion;
+import org.opensaml.SAMLException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import java.util.Properties;
+
+/**
+ *
+ */
+public class SAMLTokenIssuer implements TokenIssuer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.rahas.TokenIssuer#issue(org.apache.axiom.om.OMElement,
+ * org.apache.axis2.context.MessageContext)
+ */
+ public SOAPEnvelope issue(OMElement request, MessageContext inMsgCtx)
+ throws TrustException {
+
+ SOAPEnvelope env = this.getSOAPEnvelope(inMsgCtx);
+ // Get the document
+ Document doc = ((Element) env).getOwnerDocument();
+
+ Crypto crypto = CryptoFactory.getInstance("samlIssuer.properties",
+ inMsgCtx.getAxisService().getClassLoader());
+
+ Properties prop = new Properties();
+ prop.setProperty("org.apache.ws.security.saml.issuer.cryptoProp.fil",
+ "sctIssuer.properties");
+ prop.setProperty("org.apache.ws.security.saml.issuer.key.name", "bob");
+ prop.setProperty("org.apache.ws.security.saml.issuer.key.password",
+ "security");
+ prop.setProperty("org.apache.ws.security.saml.issuer", "www.example.com");
+ prop.setProperty("org.apache.ws.security.saml.subjectNameId.name", "uid=joe,ou=people,ou=saml-demo,o=example.com");
+ prop.setProperty("org.apache.ws.security.saml.subjectNameId.qualifier","www.example.com");
+ prop.setProperty("org.apache.ws.security.saml.authenticationMethod", "password");
+ prop.setProperty("org.apache.ws.security.saml.confirmationMethod", "senderVouches");
+
+ SAMLIssuer saml = SAMLIssuerFactory.getInstance(
+ "org.apache.ws.security.saml.SAMLIssuerImpl", prop);
+ saml.setUsername("");
+ saml.setUserCrypto(crypto);
+ saml.setInstanceDoc(doc);
+
+ // Set the DOM impl to DOOM
+ DocumentBuilderFactoryImpl.setDOOMRequired(true);
+
+ SAMLAssertion assertion = saml.newAssertion();
+
+ OMElement rstrElem = TrustUtil.createRequestSecurityTokenResponseElement(env.getBody());
+
+ try {
+ Node tempNode = assertion.toDOM();
+ rstrElem.addChild((OMNode)((Element)rstrElem).getOwnerDocument().importNode(tempNode, true));
+ } catch (SAMLException e) {
+ throw new TrustException("samlConverstionError", e);
+ }
+
+ // Set the DOM impl to DOOM
+ DocumentBuilderFactoryImpl.setDOOMRequired(false);
+ return env;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.rahas.TokenIssuer#getResponseAction(org.apache.axiom.om.OMElement,
+ * org.apache.axis2.context.MessageContext)
+ */
+ public String getResponseAction(OMElement request, MessageContext inMsgCtx)
+ throws TrustException {
+ return Constants.RSTR_ACTON_ISSUE;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.rahas.TokenIssuer#setConfigurationFile(java.lang.String)
+ */
+ public void setConfigurationFile(String configFile) {
+ // TODO TODO SAMLTokenIssuer setConfigurationFile
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.rahas.TokenIssuer#setConfigurationElement(org.apache.axiom.om.OMElement)
+ */
+ public void setConfigurationElement(OMElement configElement) {
+ // TODO TODO SAMLTokenIssuer setConfigurationElement
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.rahas.TokenIssuer#setConfigurationParamName(java.lang.String)
+ */
+ public void setConfigurationParamName(String configParamName) {
+ // TODO TODO SAMLTokenIssuer setConfigurationParamName
+ }
+
+ /**
+ * TODO: We may be able to move this to a util class since this is required
+ * for all issuers
+ *
+ * @param msgCtx
+ * @return
+ */
+ private SOAPEnvelope getSOAPEnvelope(MessageContext msgCtx) {
+ if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(msgCtx
+ .getEnvelope().getNamespace().getName())) {
+ return DOOMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+ } else {
+ return DOOMAbstractFactory.getSOAP12Factory().getDefaultEnvelope();
+ }
+ }
+
+}
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=416368&r1=416367&r2=416368&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 Thu Jun 22 06:41:11 2006
@@ -83,7 +83,8 @@
Parameter param = ConversationConfiguration.getParameter(msgContext);
if(param == null || WSSHandlerConstants.RST_ACTON_SCT.equals(msgContext.getWSAAction()) ||
- WSSHandlerConstants.RSTR_ACTON_SCT.equals(msgContext.getWSAAction())) {
+ WSSHandlerConstants.RSTR_ACTON_SCT.equals(msgContext.getWSAAction()) ||
+ WSSHandlerConstants.RSTR_ACTON_ISSUE.equals(msgContext.getWSAAction())) {
//If the msgs are msgs to an STS then use basic WS-Sec
processBasic(msgContext, disableDoom);
} else {
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSSHandlerConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSSHandlerConstants.java?rev=416368&r1=416367&r2=416368&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSSHandlerConstants.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSSHandlerConstants.java Thu Jun 22 06:41:11 2006
@@ -129,6 +129,7 @@
//TODO: Get these constants from the WS-Trust impl's constants
public final static String RST_ACTON_SCT = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT";
public final static String RSTR_ACTON_SCT = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT";
+ public final static String RSTR_ACTON_ISSUE = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue";
public final static String TOK_TYPE_SCT = "http://schemas.xmlsoap.org/ws/2005/02/sc/sct";
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org