Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r3429 - in trunk/geant2_java-as: ant conf src/main/java/org/perfsonar/service/authService src/main/java/org/perfsonar/service/testHarness/authService

Subject: perfsonar development work

List archive

perfsonar: r3429 - in trunk/geant2_java-as: ant conf src/main/java/org/perfsonar/service/authService src/main/java/org/perfsonar/service/testHarness/authService


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r3429 - in trunk/geant2_java-as: ant conf src/main/java/org/perfsonar/service/authService src/main/java/org/perfsonar/service/testHarness/authService
  • Date: Fri, 29 Feb 2008 06:15:32 -0500

Author: rodriguez
Date: 2008-02-29 06:15:32 -0500 (Fri, 29 Feb 2008)
New Revision: 3429

Modified:
trunk/geant2_java-as/ant/axis-deploy-targets.xml
trunk/geant2_java-as/ant/libs-download-targets.xml
trunk/geant2_java-as/ant/test-targets.xml
trunk/geant2_java-as/conf/wizard.properties.template

trunk/geant2_java-as/src/main/java/org/perfsonar/service/authService/AuthNAction.java

trunk/geant2_java-as/src/main/java/org/perfsonar/service/testHarness/authService/AuthNRequestTest.java
Log:
AS RC2:
- Using the last perfsonar-base
- Some minor changes in the webadmin module

Modified: trunk/geant2_java-as/ant/axis-deploy-targets.xml
===================================================================
--- trunk/geant2_java-as/ant/axis-deploy-targets.xml 2008-02-28 14:51:58
UTC (rev 3428)
+++ trunk/geant2_java-as/ant/axis-deploy-targets.xml 2008-02-29 11:15:32
UTC (rev 3429)
@@ -36,8 +36,8 @@
depends="copy-dep-base-service-jars">

<copy
file="${basedir}/lib/repository/nmwg/nmwg/1.0.20080124/nmwg-1.0.20080124.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
- <copy
file="${basedir}/lib/repository/perfsonar/perfsonar-base/1.0.20080115/perfsonar-base-1.0.20080115.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
- <copy
file="${basedir}/lib/repository/perfsonar/perfsonar-web-admin/0.5b/perfsonar-web-admin-0.5b.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
+ <copy
file="${basedir}/lib/repository/perfsonar/perfsonar-base/1.0.20080226/perfsonar-base-1.0.20080226.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
+ <copy
file="${basedir}/lib/repository/perfsonar/perfsonar-web-admin/0.6b/perfsonar-web-admin-0.6b.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
<copy
file="${basedir}/lib/repository/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar"

todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
<copy
file="${basedir}/lib/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar"

todir="${service.home}/${deploy.root}/WEB-INF/lib"/>
<copy
file="${basedir}/lib/repository/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar"
todir="${service.home}/${deploy.root}/WEB-INF/lib"/>

Modified: trunk/geant2_java-as/ant/libs-download-targets.xml
===================================================================
--- trunk/geant2_java-as/ant/libs-download-targets.xml 2008-02-28 14:51:58
UTC (rev 3428)
+++ trunk/geant2_java-as/ant/libs-download-targets.xml 2008-02-29 11:15:32
UTC (rev 3429)
@@ -54,15 +54,15 @@

<artifact:dependencies>

- <dependency groupId="perfsonar" artifactId="perfsonar-base"
version="1.0.20080115"/>
- <dependency groupId="perfsonar" artifactId="perfsonar-web-admin"
version="0.5b"/>
+ <dependency groupId="perfsonar" artifactId="perfsonar-base"
version="1.0.20080226"/>
+ <dependency groupId="perfsonar" artifactId="perfsonar-web-admin"
version="0.6b"/>
<dependency groupId="nmwg" artifactId="nmwg"
version="1.0.20080124"/>

<!-- dependencies for perfsonar-web-admin -->
<dependency groupId="commons-io"
artifactId="commons-io" version="1.3.2"/>
<dependency groupId="commons-codec"
artifactId="commons-codec" version="1.3"/>
<dependency groupId="commons-fileupload"
artifactId="commons-fileupload" version="1.2"/>
- <dependency groupId="perfsonar"
artifactId="perfsonar-web-admin" version="0.5b"/>
+ <dependency groupId="perfsonar"
artifactId="perfsonar-web-admin" version="0.6b"/>

<localRepository refid="local.repository"/>
<remoteRepository refid="remote.repository"/>

Modified: trunk/geant2_java-as/ant/test-targets.xml
===================================================================
--- trunk/geant2_java-as/ant/test-targets.xml 2008-02-28 14:51:58 UTC (rev
3428)
+++ trunk/geant2_java-as/ant/test-targets.xml 2008-02-29 11:15:32 UTC (rev
3429)
@@ -63,6 +63,8 @@
<arg value="${basedir}/conf/test-eduGAIN.key"/>
<arg value="${basedir}/conf/test-eduGAIN.pem"/>
<arg value="${basedir}/conf/objects.config"/>
+ <arg value="x509"/>
+ <arg value="${basedir}/samples/AuthNRequest.xml"/>

</java>

@@ -89,7 +91,7 @@
<java classname="org.perfsonar.client.testHarness.UbCSaslTest"
classpathref="classpath" fork="true">
<jvmarg value="-DuseSubjectCredsOnly=true"/>
- <arg value="srv2.ams.nl.geant2.net"/>
+ <arg value="homer.rediris.es"/>
<arg value="4088"/>
<arg value="${basedir}/conf/handle.jks"/>
<arg value="petete"/>

Modified: trunk/geant2_java-as/conf/wizard.properties.template
===================================================================
--- trunk/geant2_java-as/conf/wizard.properties.template 2008-02-28
14:51:58 UTC (rev 3428)
+++ trunk/geant2_java-as/conf/wizard.properties.template 2008-02-29
11:15:32 UTC (rev 3429)
@@ -34,13 +34,13 @@
</property>
<property>
<entry key="servlet.password" required="true"
password="true">perfsonarpass</entry>
- <Comment>Give the password to use for logging in to the admin
pages</Comment>
+ <Comment>Enter the password for logging in to the admin pages:</Comment>
<ProposedValue>perfsonarpass</ProposedValue>
<Group order="2">Administration</Group>
</property>
<property>
<entry key="servlet.username" required="true">perfsonaruser</entry>
- <Comment>Give the username to use for logging in to the admin
pages</Comment>
+ <Comment>Enter the username for logging in to the admin pages:</Comment>
<ProposedValue>perfsonaruser</ProposedValue>
<Group order="1" check="false">Administration</Group>
</property>
@@ -52,19 +52,19 @@
</property>
<property>
<entry key="service.as.truststore_file"
required="true">/home/perfsonar/webapps/perfSONAR-AS/WEB-INF/classes/perfsonar/conf/perfSONARtruststore.jks</entry>
- <Comment>TrustStore file containing the CA certs</Comment>
+ <Comment>Enter the full path to the TrustStore file containing the CA
certs:</Comment>

<ProposedValue>/home/perfsonar/webapps/perfSONAR-AS/WEB-INF/classes/perfsonar/conf/perfSONARtruststore.jks</ProposedValue>
<Group order="8">AS</Group>
</property>
<property>
<entry key="service.as.truststore_password"
required="true">12345678</entry>
- <Comment>Password of the TrustStore file</Comment>
+ <Comment>Enter the password for the TrustStore file:</Comment>
<ProposedValue>12345678</ProposedValue>
<Group order="9">AS</Group>
</property>
<property>
<entry key="service.as.valid_components"
required="true">/home/perfsonar/webapps/perfSONAR-AS/WEB-INF/classes/perfsonar/conf/ASValidComponentsFile</entry>
- <Comment>File containing valid Component IDs in eduGAIN</Comment>
+ <Comment>Enter the full path to a file containing valid Component IDs in
eduGAIN:</Comment>

<ProposedValue>/home/perfsonar/webapps/perfSONAR-AS/WEB-INF/classes/perfsonar/conf/ASValidComponentsFile</ProposedValue>
<Group order="10">AS</Group>
</property>

Modified:
trunk/geant2_java-as/src/main/java/org/perfsonar/service/authService/AuthNAction.java
===================================================================
---
trunk/geant2_java-as/src/main/java/org/perfsonar/service/authService/AuthNAction.java
2008-02-28 14:51:58 UTC (rev 3428)
+++
trunk/geant2_java-as/src/main/java/org/perfsonar/service/authService/AuthNAction.java
2008-02-29 11:15:32 UTC (rev 3429)
@@ -12,6 +12,7 @@
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPHeader;
import org.apache.ws.security.WSSecurityEngine;
+import org.apache.ws.security.WSSecurityException;
import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.message.token.Timestamp;
import org.ggf.ns.nmwg.base.v2_0.Data;
@@ -141,13 +142,16 @@
Vector result=secEngine.processSecurityHeader(doc,
actor, null, tsCrypto);
logger.info("AuthNAction: result=
'"+(result!=null)+"'");
if (result==null) {
- throw new
PerfSONARException("error.authn.soap","Null response checking the signature");
+ throw new
PerfSONARException("error.authn.wssec","Null response checking the
signature");
}
} catch (PerfSONARException e) {
e.printStackTrace();
String m = "Null response checking the signature";
logger.error(m);
throw e;
+ } catch (WSSecurityException e) {
+ logger.error("WSSecurityException: "+e.getMessage());
+ throw new PerfSONARException("error.authn.wssec",e);
} catch (Exception e) {
e.printStackTrace();
String m = "Error getting the SOAP envelope of the
authN request";

Modified:
trunk/geant2_java-as/src/main/java/org/perfsonar/service/testHarness/authService/AuthNRequestTest.java
===================================================================
---
trunk/geant2_java-as/src/main/java/org/perfsonar/service/testHarness/authService/AuthNRequestTest.java
2008-02-28 14:51:58 UTC (rev 3428)
+++
trunk/geant2_java-as/src/main/java/org/perfsonar/service/testHarness/authService/AuthNRequestTest.java
2008-02-29 11:15:32 UTC (rev 3429)
@@ -1,14 +1,23 @@
package org.perfsonar.service.testHarness.authService;

+import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.net.URL;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;

+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathFactory;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
@@ -18,7 +27,11 @@
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.ggf.ns.nmwg.base.v2_0.Message;
+import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.base.v2_0.Parameter;
+import org.ggf.ns.nmwg.base.v2_0.Parameters;

+import org.perfsonar.base.auxiliary.components.authn.SOAPUtil;
import org.perfsonar.base.exceptions.PerfSONARException;
import org.perfsonar.client.base.authn.AuthNX509Data;
import org.perfsonar.client.base.authn.AuthNDataFactory;
@@ -78,6 +91,41 @@
}
}

+ private void testRequestFromFile(DocumentBuilder builder, String
endPoint,String xmlFile,String saxParser) throws PerfSONARException,
IOException, SAXException {
+ org.apache.xml.security.Init.init();
+ Document request = null;
+ request = builder.parse(new File(xmlFile));
+
+ try {
+ org.apache.axis.Message signedMsg = (org.apache.axis.Message)
SOAPUtil.toSOAPMessage(request);
+ SOAPEnvelope envelope = signedMsg.getSOAPEnvelope();
+
+ SecurityToken st=new SecurityToken(new SecTokenRawManager());
+ javax.xml.soap.SOAPHeader header=envelope.getHeader();
+ st.setSecToken(header);
+
+ AuthNRequest authnReq=new AuthNRequest(st);
+ AADispatchManager aadm=new AADispatchManager(new
AADispatchBasicSOAPProtocol(endPoint,saxParser));
+ AuthNResponse authnRes=aadm.getAuthentication(authnReq);
+
+ if (authnRes.getStatus()==AuthNResponse.AUTHENTICATED) {
+ System.out.println("Result: AUTHENTICATED!");
+ }
+ else {
+ System.out.println("Result: NOT AUTHENTICATED!");
+ }
+ System.out.println("Code Result: "+authnRes.getResultCode());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new PerfSONARException("error.common.parse_error",
+ "Parse/validation error, " +
+ "Cannot convert request to Message. " +
+ "Nested error messsage was "+e.getMessage());
+
+ }
+ }
+
private void testRequestWithoutST(DocumentBuilder builder, String
endPoint,String saxParser) throws PerfSONARException, IOException,
SAXException {
Document request = builder.newDocument();
Message authnRequest = new
AuthNEERequestGenerator().generateRequestMessage();
@@ -125,11 +173,23 @@
String keyFile = null;
String certFile = null;
String saxParser = null;
- if (args.length == 4) {
+ String type = null;
+ String xmlFile = null;
+ if (args.length >= 5) {
endPoint = args[0];
keyFile = args[1];
certFile = args[2];
saxParser = args[3];
+ type = args[4];
+ if (!type.equals("x509")) {
+ if (args.length==6) {
+ xmlFile = args[5];
+ }
+ else {
+ System.out.println("Error: Wrong number
("+args.length+") of parameters!!!");
+ return;
+ }
+ }
} else {
System.out.println("Error: Wrong number ("+args.length+") of
parameters!!!");
return;
@@ -138,6 +198,7 @@
System.out.println("Private key file: " + keyFile);
System.out.println("Certificate file: " + certFile);
System.out.println("SAX parser: " + saxParser);
+ System.out.println("Type: " + type);

// read the request into a org.w3c.DOM.Document
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
@@ -147,7 +208,12 @@
System.out.println("##########################");
System.out.println("# Test #1: AuthN request #");
System.out.println("##########################");
- testRequest(builder,endPoint,keyFile,certFile,saxParser);
+ if (type.equals("x509")) {
+ testRequest(builder,endPoint,keyFile,certFile,saxParser);
+ }
+ else {
+ testRequestFromFile(builder,endPoint,xmlFile,saxParser);
+ }

System.out.println("#############################################");
System.out.println("# Test #2: AuthN request without a SecToken
#");

System.out.println("#############################################");
@@ -209,29 +275,53 @@
DocumentBuilder builder =
factory.newDocumentBuilder();
Document request = builder.newDocument();
Message authnRequest = new
AuthNEERequestGenerator().generateRequestMessage();
- request = authnRequest.getDOM(request);
- Element parameter=null;
- NodeList nodelist =
org.apache.xpath.XPathAPI.selectNodeList(request,
"//nmwg:parameter[@name='SecurityToken']");
- if (nodelist.getLength()>0) {
- parameter=(Element)nodelist.item(0);
+
+ Parameters params=null;
+ Parameter parameter=null;
+ Metadata[] mds=authnRequest.getMetadataArray();
+ for (int i=0; i<mds.length; i++) {
+ params=mds[i].getParameters();
+ Parameter[] pars=params.getParameterArray();
+ for (int j=0; j<pars.length; j++) {
+ if
(pars[j].getParameterName().equals("SecurityToken")) {
+ parameter=pars[j];
+ }
+ }
}
+
+ // build a SOAPBodyElement from the document
+ javax.xml.soap.SOAPHeader
header=(javax.xml.soap.SOAPHeader)req.getSecurityToken().getSecToken();
+ Iterator<SOAPHeaderElement>
it=header.examineAllHeaderElements();
+ while (it.hasNext()) {
+ SOAPHeaderElement
he=(SOAPHeaderElement)it.next();
+
+ // if there is any assertion, it should be a
saml security token
+ NodeList nodelist2 =
org.apache.xpath.XPathAPI.selectNodeList(he, "//wsse:BinarySecurityToken");
+ System.out.println("//// #Assertions:
"+nodelist2.getLength());
+ for (int i = 0; i < nodelist2.getLength();
i++) {
+ Element e=(Element)nodelist2.item(i);
+ System.out.println("//// "+i+":
"+e.getNodeName()+" - ValueType: "+e.getAttribute("ValueType"));
+ if
(e.getAttribute("ValueType").equals("#SAMLBase64Binary")) {
+
parameter.setParameterValue(AADispatchSOAPProtocol.WSS_SAML);
+ //params.clearParameter();
+
//authnRequest.addParameter(parameter);
+ }
+ }
+ }

- // build a SOAPBodyElement from the document
+ request = authnRequest.getDOM(request);
+
SOAPBodyElement requestMessage =
new
SOAPBodyElement(request.getDocumentElement());
SOAPEnvelope envelope = new SOAPEnvelope();
envelope.addBodyElement(requestMessage);
- javax.xml.soap.SOAPHeader
header=(javax.xml.soap.SOAPHeader)req.getSecurityToken().getSecToken();
- Iterator<SOAPHeaderElement>
it=header.examineAllHeaderElements();
+ it=header.examineAllHeaderElements();
while (it.hasNext()) {
- SOAPHeaderElement he=it.next();
- NodeList nodelist2 =
org.apache.xpath.XPathAPI.selectNodeList(he, "//Assertion");
- if (nodelist2.getLength()>0) {
-
parameter.setTextContent(AADispatchSOAPProtocol.WSS_SAML);
- }
+ SOAPHeaderElement
he=(SOAPHeaderElement)it.next();
envelope.getHeader().addChildElement(he);
}

+
StringWriter sw=new StringWriter();

XMLUtils.PrettyElementToWriter(envelope.getAsDOM(),sw);
System.out.println("---- Request message");



  • perfsonar: r3429 - in trunk/geant2_java-as: ant conf src/main/java/org/perfsonar/service/authService src/main/java/org/perfsonar/service/testHarness/authService, svnlog, 02/29/2008

Archive powered by MHonArc 2.6.16.

Top of Page