juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r1555601 - in /juddi/trunk: juddi-core/src/main/java/org/apache/juddi/mapping/ juddi-core/src/test/java/org/apache/juddi/api/impl/ uddi-ws/src/main/java/org/w3/_2000/_09/xmldsig_/
Date Sun, 05 Jan 2014 18:19:24 GMT
Author: kstam
Date: Sun Jan  5 18:19:24 2014
New Revision: 1555601

URL: http://svn.apache.org/r1555601
Log:
JUDDI-716 adding support for X509IssuerSerial

Modified:
    juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
    juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
    juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_141_JIRATest.java
    juddi/trunk/uddi-ws/src/main/java/org/w3/_2000/_09/xmldsig_/X509DataType.java

Modified: juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java?rev=1555601&r1=1555600&r2=1555601&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java (original)
+++ juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java Sun
Jan  5 18:19:24 2014
@@ -55,6 +55,7 @@ import org.w3._2000._09.xmldsig_.SPKIDat
 import org.w3._2000._09.xmldsig_.TransformType;
 import org.w3._2000._09.xmldsig_.TransformsType;
 import org.w3._2000._09.xmldsig_.X509DataType;
+import org.w3._2000._09.xmldsig_.X509IssuerSerialType;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -1136,6 +1137,11 @@ public class MappingApiToModel {
                                 modelKeyInfoValue.setKeyDataValueBytes((byte[]) x509IssuerSerialOrX509SKIOrX509SubjectName);
                         } else if (x509IssuerSerialOrX509SKIOrX509SubjectName instanceof
String) {
                                 modelKeyInfoValue.setKeyDataValueString((String) x509IssuerSerialOrX509SKIOrX509SubjectName);
+                        } else if (x509IssuerSerialOrX509SKIOrX509SubjectName instanceof
X509IssuerSerialType) {
+                        	modelX509KeyData.setKeyDataType(X509IssuerSerialType.class.getSimpleName());
+                        	X509IssuerSerialType x509IssuerSerialType = (X509IssuerSerialType)
x509IssuerSerialOrX509SKIOrX509SubjectName;
+                        	modelX509KeyData.setKeyDataValueString(x509IssuerSerialType.getX509IssuerName());
+                        	modelX509KeyData.setKeyDataValueBytes(x509IssuerSerialType.getX509SerialNumber().toByteArray());
                         } else if (x509IssuerSerialOrX509SKIOrX509SubjectName != null) {
                                 throw new RuntimeException("Unrecognized Value for Element:
" + tagName + ": " + x509IssuerSerialOrX509SKIOrX509SubjectName.getClass().getCanonicalName());
                         }

Modified: juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java?rev=1555601&r1=1555600&r2=1555601&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java (original)
+++ juddi/trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java Sun
Jan  5 18:19:24 2014
@@ -18,14 +18,15 @@
 package org.apache.juddi.mapping;
 
 import java.io.ByteArrayInputStream;
+import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import javax.xml.bind.JAXBElement;
 
+import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.datatype.DatatypeConfigurationException;
 import javax.xml.datatype.DatatypeFactory;
@@ -73,6 +74,7 @@ import org.w3._2000._09.xmldsig_.SignedI
 import org.w3._2000._09.xmldsig_.TransformType;
 import org.w3._2000._09.xmldsig_.TransformsType;
 import org.w3._2000._09.xmldsig_.X509DataType;
+import org.w3._2000._09.xmldsig_.X509IssuerSerialType;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -222,7 +224,7 @@ public class MappingModelToApi {
                         mapModelKeyDataValue(modelKeyDataValue.getKeyDataValueList(), childKeyDataList);
                         x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().addAll(childKeyDataList);
                         JAXBElement dataJAXB = new JAXBElement(new QName("http://www.w3.org/2000/09/xmldsig#",
tagName), X509DataType.class, x509DataType);
-                        parentKeyDataList.add(dataJAXB);   
+                        parentKeyDataList.add(dataJAXB);
                     } else if (dataType.equals(RetrievalMethodType.class.getSimpleName()))
{
                         RetrievalMethodType retrievalMethodType = new RetrievalMethodType();
                         TransformsType transformsType = new TransformsType();
@@ -330,8 +332,16 @@ public class MappingModelToApi {
                         throw new RuntimeException("Unrecognized type: " + dataType);
                     }
                 } else {
-                    JAXBElement dataJAXB = new JAXBElement(new QName("http://www.w3.org/2000/09/xmldsig#",
tagName), contents.getClass(), contents);
-                    parentKeyDataList.add(dataJAXB);
+                	 if (dataType!=null && dataType.equals(X509IssuerSerialType.class.getSimpleName()))
{
+                     	X509IssuerSerialType x509IssuerSerialType = new X509IssuerSerialType();
+                     	x509IssuerSerialType.setX509IssuerName(contentStr);
+                     	x509IssuerSerialType.setX509SerialNumber(new BigInteger(contentBytes));
+                        JAXBElement dataJAXB = new JAXBElement(new QName("http://www.w3.org/2000/09/xmldsig#",
tagName), X509IssuerSerialType.class, x509IssuerSerialType);
+                        parentKeyDataList.add(dataJAXB);
+                	 } else {
+                		JAXBElement dataJAXB = new JAXBElement(new QName("http://www.w3.org/2000/09/xmldsig#",
tagName), contents.getClass(), contents);
+                		parentKeyDataList.add(dataJAXB);
+                	 }
                 }
             }
         }

Modified: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_141_JIRATest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_141_JIRATest.java?rev=1555601&r1=1555600&r2=1555601&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_141_JIRATest.java (original)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_141_JIRATest.java Sun
Jan  5 18:19:24 2014
@@ -17,6 +17,7 @@ package org.apache.juddi.api.impl;
 import java.security.cert.CertificateException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
 
 import javax.xml.soap.SOAPFault;
 
@@ -24,6 +25,7 @@ import org.apache.commons.configuration.
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.juddi.Registry;
+import org.apache.juddi.jaxb.PrintUDDI;
 import org.apache.juddi.v3.client.UDDIConstants;
 import org.apache.juddi.v3.client.config.UDDIClient;
 import org.apache.juddi.v3.client.cryptor.DigSigUtil;
@@ -55,6 +57,7 @@ import org.uddi.api_v3.FindBusiness;
 import org.uddi.api_v3.FindQualifiers;
 import org.uddi.api_v3.FindService;
 import org.uddi.api_v3.FindTModel;
+import org.uddi.api_v3.GetBusinessDetail;
 import org.uddi.api_v3.KeyedReference;
 import org.uddi.api_v3.Name;
 import org.uddi.api_v3.SaveBinding;
@@ -912,7 +915,7 @@ public class API_141_JIRATest {
             BusinessDetail saveBusiness = publication.saveBusiness(sb);
             Assert.fail("unexpected success");
         } catch (Exception ex) {
-            logger.info("Expected failure: "+ ex.getMessage());
+            logger.info("Expected failure: " + ex.getMessage());
             throw ex;
         }
     }
@@ -1090,28 +1093,26 @@ public class API_141_JIRATest {
             logger.info("Expected failure: " + ex.getMessage());
         }
     }
-    
-    
+
     @Test()
     public void JUDDI_712_SaveTModelWithSignature() throws CertificateException {
         SaveTModel sb = new SaveTModel();
         sb.setAuthInfo(authInfoJoe);
         DigSigUtil ds = GetDigSig();
         TModel bs = new TModel();
-        bs.setName(new Name("Joe's Tmodel",null));
+        bs.setName(new Name("Joe's Tmodel", null));
         bs = ds.signUddiEntity(bs);
-        
+
 
         sb.getTModel().add(bs);
         try {
             publication.saveTModel(sb);
             Assert.fail("unexpected success");
         } catch (Exception ex) {
-            logger.info("Expected failure: "+ ex.getMessage());
+            logger.info("Expected failure: " + ex.getMessage());
         }
     }
-    
-    
+
     @Test()
     public void JUDDI_712_SaveService4BTWithSignature() throws CertificateException {
         SaveBusiness sb = new SaveBusiness();
@@ -1139,7 +1140,7 @@ public class API_141_JIRATest {
         bt.setBindingKey(TckBusinessService.JOE_BINDING_KEY_1);
         bt.setServiceKey(null);
         bt.setAccessPoint(new AccessPoint("http://localhost", "wsdl"));
-        
+
         bs.getName().add(new Name("Joe's bs", null));
         DigSigUtil ds = GetDigSig();
         bt = ds.signUddiEntity(bt);
@@ -1156,7 +1157,7 @@ public class API_141_JIRATest {
             logger.info("Expected failure: " + ex.getMessage());
         }
     }
-    
+
     @Test()
     public void JUDDI_712_SaveService5BTWithSignature() throws CertificateException {
         SaveBusiness sb = new SaveBusiness();
@@ -1184,7 +1185,7 @@ public class API_141_JIRATest {
         bt.setBindingKey(null);
         bt.setServiceKey(null);
         bt.setAccessPoint(new AccessPoint("http://localhost", "wsdl"));
-        
+
         bs.getName().add(new Name("Joe's bs", null));
         DigSigUtil ds = GetDigSig();
         bt = ds.signUddiEntity(bt);
@@ -1201,7 +1202,7 @@ public class API_141_JIRATest {
             logger.info("Expected failure: " + ex.getMessage());
         }
     }
-    
+
     @Test()
     public void JUDDI_712_SaveService6BTWithSignature() throws CertificateException {
         SaveBusiness sb = new SaveBusiness();
@@ -1229,7 +1230,7 @@ public class API_141_JIRATest {
         bt.setBindingKey(null);
         bt.setServiceKey(TckBusinessService.JOE_SERVICE_KEY);
         bt.setAccessPoint(new AccessPoint("http://localhost", "wsdl"));
-        
+
         bs.getName().add(new Name("Joe's bs", null));
         DigSigUtil ds = GetDigSig();
         bt = ds.signUddiEntity(bt);
@@ -1246,11 +1247,9 @@ public class API_141_JIRATest {
             logger.info("Expected failure: " + ex.getMessage());
         }
     }
-    
-    
-    
+
     @Test()
-    public void JUDDI_712_SaveBindingWithSignature() throws CertificateException {
+    public void JUDDI_712_SaveBusinessWithSignature() throws CertificateException {
         SaveBusiness sb = new SaveBusiness();
         sb.setAuthInfo(authInfoJoe);
         BusinessEntity be = new BusinessEntity();
@@ -1271,46 +1270,77 @@ public class API_141_JIRATest {
         BusinessService bs = new BusinessService();
         bs.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY);
         bs.setServiceKey(TckBusinessService.JOE_SERVICE_KEY);
-        bs.getName().add(new Name("joe's service",null));
-        
-        
+        bs.getName().add(new Name("joe's service", null));
+
+
         be.setBusinessServices(new BusinessServices());
         be.getBusinessServices().getBusinessService().add(bs);
 
 
         sb.getBusinessEntity().add(be);
-        ServiceDetail saveService=null;
+        ServiceDetail saveService = null;
         ss.getBusinessService().add(bs);
         try {
-             saveService = publication.saveService(ss);
+            saveService = publication.saveService(ss);
         } catch (Exception ex) {
             //logger.error("unExpected failure: ",ex);
             Assert.fail("unexpected failure " + ex.getMessage() + ex.toString());
         }
-        
-        
+
+
         bs = saveService.getBusinessService().get(0);
         bs.setBindingTemplates(new BindingTemplates());
         BindingTemplate bt = new BindingTemplate();
         bt.setBindingKey(null);
         bt.setServiceKey(TckBusinessService.JOE_SERVICE_KEY);
         bt.setAccessPoint(new AccessPoint("http://localhost", "wsdl"));
-        
+
         bs.getName().add(new Name("Joe's bs", null));
         DigSigUtil ds = GetDigSig();
         bt = ds.signUddiEntity(bt);
         bs.getBindingTemplates().getBindingTemplate().add(bt);
-        
-         try {
-             SaveBinding sb1 = new SaveBinding();
-             sb1.setAuthInfo(authInfoJoe);
-             sb1.getBindingTemplate().add(bt);
-             publication.saveBinding(sb1);
-             Assert.fail("unexpected success");
+
+        try {
+            SaveBinding sb1 = new SaveBinding();
+            sb1.setAuthInfo(authInfoJoe);
+            sb1.getBindingTemplate().add(bt);
+            publication.saveBinding(sb1);
+            Assert.fail("unexpected success");
         } catch (Exception ex) {
             logger.info("Expected failure: " + ex.getMessage());
         }
     }
-    
-    
+
+    @Test()
+    public void JUDDI_716_SaveBusinessWithSignatureX509IssuerSerial() throws CertificateException
{
+        SaveBusiness sb = new SaveBusiness();
+        sb.setAuthInfo(authInfoJoe);
+        BusinessEntity be = new BusinessEntity();
+        be.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY);
+                
+        Name n = new Name();
+        n.setValue("JUDDI_716_SaveBusinessWithSignatureX509IssuerSerial");
+        be.getName().add(n);
+        DigSigUtil ds = GetDigSig();
+        ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
+        be = ds.signUddiEntity(be);
+        sb.getBusinessEntity().add(be);
+        try {
+            BusinessDetail saveBusiness = publication.saveBusiness(sb);
+            GetBusinessDetail gsb=new GetBusinessDetail();
+            gsb.setAuthInfo(authInfoJoe);
+            gsb.getBusinessKey().add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
+            BusinessDetail businessDetail = inquiry.getBusinessDetail(gsb);
+            PrintUDDI<BusinessEntity> printer = new PrintUDDI<BusinessEntity>();
+            System.out.println(printer.print(businessDetail.getBusinessEntity().get(0)));
+            AtomicReference<String> msg = new AtomicReference<String>();
+            boolean b=ds.verifySignedUddiEntity(businessDetail.getBusinessEntity().get(0),
msg);
+            Assert.assertTrue(msg.get(),b );
+            Assert.assertTrue(msg.get()==null || msg.get().length()==0);
+
+        } catch (Exception ex) {
+            logger.error("unExpected failure: ", ex);
+            Assert.fail("unexpected failure");
+        }
+    }
 }

Modified: juddi/trunk/uddi-ws/src/main/java/org/w3/_2000/_09/xmldsig_/X509DataType.java
URL: http://svn.apache.org/viewvc/juddi/trunk/uddi-ws/src/main/java/org/w3/_2000/_09/xmldsig_/X509DataType.java?rev=1555601&r1=1555600&r2=1555601&view=diff
==============================================================================
--- juddi/trunk/uddi-ws/src/main/java/org/w3/_2000/_09/xmldsig_/X509DataType.java (original)
+++ juddi/trunk/uddi-ws/src/main/java/org/w3/_2000/_09/xmldsig_/X509DataType.java Sun Jan
 5 18:19:24 2014
@@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlAnyElement;
 import javax.xml.bind.annotation.XmlElementRef;
 import javax.xml.bind.annotation.XmlElementRefs;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlType;
 import org.w3c.dom.Element;
 
@@ -60,6 +61,7 @@ import org.w3c.dom.Element;
 @XmlType(name = "X509DataType", propOrder = {
     "x509IssuerSerialOrX509SKIOrX509SubjectName"
 })
+@XmlSeeAlso({X509IssuerSerialType.class})
 public class X509DataType {
 
     @XmlElementRefs({



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org


Mime
View raw message