perfsonar-dev - perfsonar: r3396 - in trunk/perfsonar_base: ant src/main/java/org/perfsonar/client/base/authn src/main/java/org/perfsonar/service/base/authn
Subject: perfsonar development work
List archive
perfsonar: r3396 - in trunk/perfsonar_base: ant src/main/java/org/perfsonar/client/base/authn src/main/java/org/perfsonar/service/base/authn
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3396 - in trunk/perfsonar_base: ant src/main/java/org/perfsonar/client/base/authn src/main/java/org/perfsonar/service/base/authn
- Date: Mon, 25 Feb 2008 06:53:39 -0500
Author: rodriguez
Date: 2008-02-25 06:53:39 -0500 (Mon, 25 Feb 2008)
New Revision: 3396
Modified:
trunk/perfsonar_base/ant/const.properties
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNX509Data.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNX509Data.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchSOAPProtocol.java
Log:
Fix bug#357. More info at https://bugzilla.perfsonar.net/show_bug.cgi?id=357
Modified: trunk/perfsonar_base/ant/const.properties
===================================================================
--- trunk/perfsonar_base/ant/const.properties 2008-02-25 11:11:17 UTC (rev
3395)
+++ trunk/perfsonar_base/ant/const.properties 2008-02-25 11:53:39 UTC (rev
3396)
@@ -13,4 +13,4 @@
# name of jar file to be created
jarfilename=perfsonar-base
# version of the product (will be included in the final name of jar file)
-version=1.0.20080204
+version=1.0.20080225
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNX509Data.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNX509Data.java
2008-02-25 11:11:17 UTC (rev 3395)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNX509Data.java
2008-02-25 11:53:39 UTC (rev 3396)
@@ -8,4 +8,6 @@
public interface AuthNX509Data {
public Object addX509STInMessage(Object message,String
privKeyFile,String certFile) throws PerfSONARException;
public Object addX509STInMessage(Object message,PrivateKey
privateKey,X509Certificate cert) throws PerfSONARException;
+ public Object addX509STInMessage(Object message,String
privKeyFile,String certFile,int ttl) throws PerfSONARException;
+ public Object addX509STInMessage(Object message,PrivateKey
privateKey,X509Certificate cert,int ttl) throws PerfSONARException;
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNX509Data.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNX509Data.java
2008-02-25 11:11:17 UTC (rev 3395)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNX509Data.java
2008-02-25 11:53:39 UTC (rev 3396)
@@ -35,8 +35,13 @@
import org.w3c.dom.Document;
public class WSSAuthNX509Data implements AuthNX509Data {
+ private static int defaultTtl=900;
public Object addX509STInMessage(Object message,String
privKeyFile,String certFile) throws PerfSONARException {
+ return
addX509STInMessage(message,privKeyFile,certFile,defaultTtl);
+ }
+
+ public Object addX509STInMessage(Object message,String
privKeyFile,String certFile,int ttl) throws PerfSONARException {
if (!(message instanceof SOAPBodyElement)) {
throw new
PerfSONARException("error.as.body","WSSAuthNData: the method
addX509STInMessage requires a SOAPBodyElement object");
}
@@ -56,10 +61,10 @@
X509Certificate cert=addCertificate(crypto,certFile);
PrivateKey privateKey=addPrivateKey(privKeyFile);
- return addX509STInMessage(message, privateKey, cert);
+ return addX509STInMessage(message, privateKey, cert, ttl);
}
-
- public Object addX509STInMessage(Object message,PrivateKey
privateKey,X509Certificate cert) throws PerfSONARException {
+
+ public Object addX509STInMessage(Object message,PrivateKey
privateKey,X509Certificate cert, int ttl) throws PerfSONARException {
if (!(message instanceof SOAPBodyElement)) {
throw new
PerfSONARException("error.as.body","WSSAuthNData: the method
addX509STInMessage requires a SOAPBodyElement object");
}
@@ -107,6 +112,7 @@
// Adding timestamp information
WSSecTimestamp timestamp = new WSSecTimestamp();
+ timestamp.setTimeToLive(ttl);
timestamp.prepare(doc);
WSSecurityUtil.prependChildElement(doc, secHeader
.getSecurityHeader(), timestamp.getElement(), false);
@@ -125,6 +131,10 @@
}
return envelope;
+ }
+
+ public Object addX509STInMessage(Object message,PrivateKey
privateKey,X509Certificate cert) throws PerfSONARException {
+ return addX509STInMessage(message,privateKey,cert,defaultTtl);
}
private PrivateKey addPrivateKey(String privKeyFile) throws
PerfSONARException {
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchSOAPProtocol.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchSOAPProtocol.java
2008-02-25 11:11:17 UTC (rev 3395)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchSOAPProtocol.java
2008-02-25 11:53:39 UTC (rev 3396)
@@ -9,8 +9,6 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
@@ -18,6 +16,9 @@
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.utils.XMLUtils;
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.AuxiliaryComponentManager;
import org.perfsonar.base.auxiliary.ComponentNames;
import
org.perfsonar.base.auxiliary.components.configuration.ConfigurationComponent;
@@ -93,37 +94,48 @@
DocumentBuilder builder =
factory.newDocumentBuilder();
Document request = builder.newDocument();
Message authnRequest = new
AuthNEERequestGenerator().generateRequestMessage();
- request = authnRequest.getDOM(request);
// get the parameter which specifies the format of
the security token
- 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
- 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 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, "//Assertion");
+ NodeList nodelist2 =
org.apache.xpath.XPathAPI.selectNodeList(he, "//wsse:BinarySecurityToken");
for (int i = 0; i < nodelist2.getLength();
i++) {
Element e=(Element)nodelist2.item(i);
if
(e.getAttribute("ValueType").equals("#SAMLBase64Binary")) {
-
parameter.setTextContent(AADispatchSOAPProtocol.WSS_SAML);
+
parameter.setParameterValue(AADispatchSOAPProtocol.WSS_SAML);
}
}
-
+ }
+
+ request = authnRequest.getDOM(request);
+
+ SOAPBodyElement requestMessage =
+ new
SOAPBodyElement(request.getDocumentElement());
+ SOAPEnvelope envelope = new SOAPEnvelope();
+ envelope.addBodyElement(requestMessage);
+ it=header.examineAllHeaderElements();
+ while (it.hasNext()) {
+ SOAPHeaderElement
he=(SOAPHeaderElement)it.next();
envelope.getHeader().addChildElement(he);
}
-
+
StringWriter sw=new StringWriter();
XMLUtils.PrettyElementToWriter(requestMessage.getAsDOM(),sw);
- perfsonar: r3396 - in trunk/perfsonar_base: ant src/main/java/org/perfsonar/client/base/authn src/main/java/org/perfsonar/service/base/authn, svnlog, 02/25/2008
Archive powered by MHonArc 2.6.16.