perfsonar-dev - perfsonar: r2330 - in branches/as/src/org/perfsonar: client/testHarness commons/auxiliary/components/authn service/commons/authn service/topologyService
Subject: perfsonar development work
List archive
perfsonar: r2330 - in branches/as/src/org/perfsonar: client/testHarness commons/auxiliary/components/authn service/commons/authn service/topologyService
Chronological Thread
- From:
- To:
- Subject: perfsonar: r2330 - in branches/as/src/org/perfsonar: client/testHarness commons/auxiliary/components/authn service/commons/authn service/topologyService
- Date: Tue, 17 Apr 2007 07:09:26 -0400
Author: rodriguez
Date: 2007-04-17 07:09:26 -0400 (Tue, 17 Apr 2007)
New Revision: 2330
Removed:
branches/as/src/org/perfsonar/commons/auxiliary/components/authn/WSSecX509Token.java
Modified:
branches/as/src/org/perfsonar/client/testHarness/SOAPX509Client.java
branches/as/src/org/perfsonar/service/commons/authn/AADispatchManager.java
branches/as/src/org/perfsonar/service/commons/authn/AADispatchProtocol.java
branches/as/src/org/perfsonar/service/commons/authn/AADispatchSOAPProtocol.java
branches/as/src/org/perfsonar/service/commons/authn/AuthNRequest.java
branches/as/src/org/perfsonar/service/commons/authn/AuthNResponse.java
branches/as/src/org/perfsonar/service/topologyService/TopServiceEngine.java
Log:
Updating the authn library in perfSONAR base and the example of an AC client
sending a X.509 certificate
Modified: branches/as/src/org/perfsonar/client/testHarness/SOAPX509Client.java
===================================================================
--- branches/as/src/org/perfsonar/client/testHarness/SOAPX509Client.java
2007-04-13 13:04:24 UTC (rev 2329)
+++ branches/as/src/org/perfsonar/client/testHarness/SOAPX509Client.java
2007-04-17 11:09:26 UTC (rev 2330)
@@ -13,7 +13,6 @@
import java.security.PrivateKey;
import java.security.Provider;
import java.security.cert.Certificate;
-import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Vector;
@@ -40,11 +39,9 @@
import org.apache.xml.serialize.XMLSerializer;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.w3c.dom.Document;
-import org.w3c.dom.Element;
import org.perfsonar.commons.auxiliary.components.authn.DynamicCrypto;
import org.perfsonar.commons.auxiliary.components.authn.SOAPUtil;
-import org.perfsonar.commons.auxiliary.components.authn.WSSecX509Token;
/**
* Class which provides the basic web service (Doc/Lit) client capability
@@ -56,8 +53,6 @@
public class SOAPX509Client {
- // suppress deprication for outputter.setIndent/setNewlines methods
- // jwb
@SuppressWarnings(value={"deprecation"})
public void makeRequest(String[] args) {
try {
@@ -83,18 +78,15 @@
System.out.println("Certificate file: " + certFile);
// read the certificate... more or less...
- System.out.println("// read the certificate... more or less...");
InputStream isCert=new FileInputStream(certFile);
// prepare to call - set service elements
- System.out.println("// prepare to call - set service elements");
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(endPoint));
call.setOperationName(new
QName("http://soapinterop.org/","submit"));
// read the request into a org.w3c.DOM.Document
- System.out.println("// read the request into a
org.w3c.DOM.Document");
Document request = null;
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
@@ -103,18 +95,16 @@
request = builder.parse(new File(inputFile));
// build a SOAPBodyElement from the document
- System.out.println("// build a SOAPBodyElement from the
document");
SOAPBodyElement requestMessage =
new SOAPBodyElement(request.getDocumentElement());
SOAPEnvelope envelope = new SOAPEnvelope();
envelope.addBodyElement(requestMessage);
- // add the certificate
- System.out.println("// add the keys and the certificate");
-// add the security provider
+ // add the security provider
BouncyCastleProvider bcp = new BouncyCastleProvider();
java.security.Security.addProvider((Provider)bcp);
+ // add the private and public keys
Crypto crypto = new DynamicCrypto();
KeyStore ks=crypto.getKeyStore();
@@ -128,7 +118,6 @@
previousStr=str+"\n";
}
in.close();
- System.out.println("Private key:\n"+data);
byte[] bytes=Base64.decode(data);
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(bytes);
@@ -140,20 +129,11 @@
WSSecSignature sec509 = new WSSecSignature();
sec509.setUserInfo("xmlsec", "security");
SOAPConstants soapConstants =
WSSecurityUtil.getSOAPConstants(envelope.getAsDOM());
- Vector parts = new Vector();
+ Vector<WSEncryptionPart> parts = new
Vector<WSEncryptionPart>(1,1);
- /*
- * Set up to sign body and use STRTransorm to sign
- * the signature token (e.g. X.509 certificate)
- */
+ // Set up to use STRTransorm to sign the signature token
WSEncryptionPart encP =
new WSEncryptionPart(
- soapConstants.getBodyQName().getLocalPart(),
- soapConstants.getEnvelopeURI(),
- "Content");
- parts.add(encP);
- encP =
- new WSEncryptionPart(
"STRTransform",
soapConstants.getEnvelopeURI(),
"Content");
@@ -164,43 +144,29 @@
Document doc = envelope.getAsDocument();
WSSecHeader secHeader = new WSSecHeader();
- secHeader.setMustUnderstand(false);
+ secHeader.setActor("test");
secHeader.insertSecurityHeader(doc);
- System.out.println("// Signing the message");
+
+ // Signing the message
Document signedDoc = sec509.build(doc, crypto, secHeader);
- System.out.println("// Signed the message");
-/* Document doc = envelope.getAsDocument();
- WSSecHeader secHeader = new WSSecHeader();
- secHeader.setMustUnderstand(false);
- secHeader.insertSecurityHeader(doc);
- WSSecX509Token sec509=new WSSecX509Token();
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- X509Certificate cert = (X509Certificate)
cf.generateCertificate(isCert);
- sec509.build(doc, cert, secHeader); */
-
Message signedMsg = (Message) SOAPUtil.toSOAPMessage(signedDoc);
envelope = signedMsg.getSOAPEnvelope();
- System.out.println("Saving SOAP message");
+ // Saving SOAP message
saveSOAPMessage(envelope.getAsDocument(), inputFile);
// get a timestamp.
- System.out.println("// get a timestamp.");
double startTime =
new Long(System.currentTimeMillis()).doubleValue();
// call on the end point
- System.out.println("// call on the end point");
Object resultObject = call.invoke(envelope);
// get another timestamp
double endTime =
new Long(System.currentTimeMillis()).doubleValue();
- // result object is a vector - strange!!! But this is how the
world works :-D
- // we will now extract the result from the vector
- System.out.println("// result object is a vector - strange!!!");
SOAPEnvelope envelopeResult;
SOAPBodyElement resultSBE;
Document result = null;
Deleted:
branches/as/src/org/perfsonar/commons/auxiliary/components/authn/WSSecX509Token.java
Modified:
branches/as/src/org/perfsonar/service/commons/authn/AADispatchManager.java
===================================================================
---
branches/as/src/org/perfsonar/service/commons/authn/AADispatchManager.java
2007-04-13 13:04:24 UTC (rev 2329)
+++
branches/as/src/org/perfsonar/service/commons/authn/AADispatchManager.java
2007-04-17 11:09:26 UTC (rev 2330)
@@ -7,7 +7,7 @@
this.protocol=prot;
}
- public AuthNResponse getAuthorizationService(String
nameService,AuthNRequest req) {
- return protocol.getAuthorizationService(nameService, req);
+ public AuthNResponse getAuthentication(AuthNRequest req) {
+ return protocol.getAuthentication(req);
}
}
Modified:
branches/as/src/org/perfsonar/service/commons/authn/AADispatchProtocol.java
===================================================================
---
branches/as/src/org/perfsonar/service/commons/authn/AADispatchProtocol.java
2007-04-13 13:04:24 UTC (rev 2329)
+++
branches/as/src/org/perfsonar/service/commons/authn/AADispatchProtocol.java
2007-04-17 11:09:26 UTC (rev 2330)
@@ -1,5 +1,5 @@
package org.perfsonar.service.commons.authn;
public interface AADispatchProtocol {
- public AuthNResponse getAuthorizationService(String
nameService,AuthNRequest req);
+ public AuthNResponse getAuthentication(AuthNRequest req);
}
Modified:
branches/as/src/org/perfsonar/service/commons/authn/AADispatchSOAPProtocol.java
===================================================================
---
branches/as/src/org/perfsonar/service/commons/authn/AADispatchSOAPProtocol.java
2007-04-13 13:04:24 UTC (rev 2329)
+++
branches/as/src/org/perfsonar/service/commons/authn/AADispatchSOAPProtocol.java
2007-04-17 11:09:26 UTC (rev 2330)
@@ -37,8 +37,7 @@
}
}
- public AuthNResponse getAuthorizationService(String nameService,
- AuthNRequest req) {
+ public AuthNResponse getAuthentication(AuthNRequest req) {
// TODO Make a real response
AuthNResponse resp=new AuthNResponse();
if (!isAuthorized)
Modified:
branches/as/src/org/perfsonar/service/commons/authn/AuthNRequest.java
===================================================================
--- branches/as/src/org/perfsonar/service/commons/authn/AuthNRequest.java
2007-04-13 13:04:24 UTC (rev 2329)
+++ branches/as/src/org/perfsonar/service/commons/authn/AuthNRequest.java
2007-04-17 11:09:26 UTC (rev 2330)
@@ -13,11 +13,11 @@
this.st=st;
}
- public SecurityToken getSt() {
+ public SecurityToken getSecurityToken() {
return st;
}
- public void setSt(SecurityToken st) {
+ public void setSecurityToken(SecurityToken st) {
this.st = st;
}
}
Modified:
branches/as/src/org/perfsonar/service/commons/authn/AuthNResponse.java
===================================================================
--- branches/as/src/org/perfsonar/service/commons/authn/AuthNResponse.java
2007-04-13 13:04:24 UTC (rev 2329)
+++ branches/as/src/org/perfsonar/service/commons/authn/AuthNResponse.java
2007-04-17 11:09:26 UTC (rev 2330)
@@ -1,20 +1,12 @@
package org.perfsonar.service.commons.authn;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
public class AuthNResponse {
public static final int AUTHORIZED=0;
public static final int NOT_AUTHORIZED=1;
private int status;
- private Map<String, Vector<Object>> attrList;
-
public AuthNResponse() {
status=AuthNResponse.NOT_AUTHORIZED;
- attrList=new HashMap<String, Vector<Object>>();
}
public int getStatus() {
@@ -25,38 +17,4 @@
this.status = status;
}
- public String[] getNameAttributes() {
- String[] res=new String[attrList.size()];
- Set<String> aList=attrList.keySet();
- res=aList.toArray(res);
- return res;
- }
-
- public Vector getAttributeValues(String nameAttribute) {
- return attrList.get(nameAttribute);
- }
-
- public boolean addAttribute(String nameAttribute, Object value) {
- if (!attrList.containsKey(nameAttribute)) {
- Vector<Object> v=new Vector<Object>(1,1);
- attrList.put(nameAttribute, v);
- }
- Vector<Object> v=attrList.get(nameAttribute);
- if (v.contains(value)) {
- return false;
- }
- return v.add(value);
- }
-
- public boolean removeAttribute(String nameAttribute) {
- if (attrList.containsKey(nameAttribute)) {
- attrList.remove(nameAttribute);
- return true;
- }
- return false;
- }
-
- public void cleanAttributes() {
- attrList.clear();
- }
}
Modified:
branches/as/src/org/perfsonar/service/topologyService/TopServiceEngine.java
===================================================================
---
branches/as/src/org/perfsonar/service/topologyService/TopServiceEngine.java
2007-04-13 13:04:24 UTC (rev 2329)
+++
branches/as/src/org/perfsonar/service/topologyService/TopServiceEngine.java
2007-04-17 11:09:26 UTC (rev 2330)
@@ -223,7 +223,7 @@
st.setSecTokenFromRequest();
AuthNRequest req=new AuthNRequest(st);
AADispatchManager aaManager=new
AADispatchManager(AADispatchProtocolFactory.getDefaultAADispatchProtocol());
- resp=aaManager.getAuthorizationService(getType(),
req);
+ resp=aaManager.getAuthentication(req);
}
if (resp!=null&&resp.getStatus()==AuthNResponse.AUTHORIZED) {
- perfsonar: r2330 - in branches/as/src/org/perfsonar: client/testHarness commons/auxiliary/components/authn service/commons/authn service/topologyService, svnlog, 04/17/2007
Archive powered by MHonArc 2.6.16.