[idwsfconsumer] 12/25: Finish basic porting to OpenSAML v3.

Scott Cantor cantor.2 at osu.edu
Wed Nov 18 14:41:16 EST 2015


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository idwsfconsumer.

commit e610a4f66c2e75f0c66b93b961b3d6b47ac8b4e9
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Wed Apr 1 20:18:50 2015 -0400

    Finish basic porting to OpenSAML v3.
---
 pom.xml                                            |   7 ++
 .../org/openliberty/wsc/OpenLibertyBootstrap.java  |  20 ++--
 src/main/resources/wsa-config.xml                  |   6 --
 .../org/openliberty/wsc/test/ClientLibTest.java    |  40 +++----
 src/test/java/org/openliberty/wsc/test/Demo.java   |  10 +-
 .../openliberty/wsc/test/PeopleServiceTest.java    |   9 +-
 src/test/resources/log4j.xml                       | 118 ---------------------
 src/test/resources/logback-test.xml                |  28 +++++
 8 files changed, 71 insertions(+), 167 deletions(-)

diff --git a/pom.xml b/pom.xml
index eb54465..1b87d55 100644
--- a/pom.xml
+++ b/pom.xml
@@ -125,6 +125,13 @@
             <scope>test</scope>
         </dependency>
         
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>1.1.2</version>
+            <scope>test</scope>
+        </dependency>
+        
     </dependencies>
 
 </project>
diff --git a/src/main/java/org/openliberty/wsc/OpenLibertyBootstrap.java b/src/main/java/org/openliberty/wsc/OpenLibertyBootstrap.java
index e456811..2eb7f4d 100755
--- a/src/main/java/org/openliberty/wsc/OpenLibertyBootstrap.java
+++ b/src/main/java/org/openliberty/wsc/OpenLibertyBootstrap.java
@@ -5,6 +5,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.log4j.Logger;
+import org.opensaml.core.config.InitializationException;
+import org.opensaml.core.config.InitializationService;
 import org.opensaml.core.xml.config.XMLConfigurationException;
 import org.opensaml.core.xml.config.XMLConfigurator;
 
@@ -113,11 +115,6 @@ public class OpenLibertyBootstrap
             "/ps-config.xml",
             "/pp-config.xml",
             "/soap-binding-xmltooling-config.xml",
-            "/soap11-config.xml",			// from java-openws
-			"/saml2-assertion-config.xml",	// from java-opensaml2
-			"/saml1-assertion-config.xml",	// from java-opensaml1
-			"/encryption-config.xml",		// from java-xmltooling
-			"/signature-config.xml",		// from java-xmltooling
 			"/openliberty-soap11-config.xml",
             "/sec-config.xml",
             "/subs-config.xml"
@@ -136,11 +133,20 @@ public class OpenLibertyBootstrap
      */
     public static synchronized void bootstrap() throws XMLConfigurationException 
     {
+        initializeOpenSAML();
     	initializeXMLTooling(xmlToolingConfigs);
         initializeClientLibProperties();
         // SSLUtilities.initializeSSLProtocol();        
     }
     
+    private static void initializeOpenSAML() {
+        try {
+            InitializationService.initialize();
+        } catch (InitializationException e) {
+            log.error("Error initializing OpenSAML", e);
+        }
+    }
+
     /**
      * Initializes the OpenLiberty library, loading default configurations, and providing a mechanism
      * for a user to specify additional configs
@@ -189,7 +195,9 @@ public class OpenLibertyBootstrap
         for (String config : providerConfigs) 
         {
         	log.info("Loading XMLTooling configuration " + config);
-        	configurator.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(config));
+        	//configurator.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(config));
+        	//TODO
+        	configurator.load(configurator.getClass().getResourceAsStream(config));
         }
     }
     
diff --git a/src/main/resources/wsa-config.xml b/src/main/resources/wsa-config.xml
index 2935506..06177a4 100644
--- a/src/main/resources/wsa-config.xml
+++ b/src/main/resources/wsa-config.xml
@@ -76,12 +76,6 @@
             <UnmarshallingClass className="org.openliberty.xmltooling.wsa.ReferenceParameters$Unmarshaller" />
         </ObjectProvider>
         
-        <ObjectProvider qualifiedName="DEFAULT">
-            <BuilderClass className="org.opensaml.xml.schema.impl.XSAnyBuilder" />
-            <MarshallingClass className="org.opensaml.xml.schema.impl.XSAnyMarshaller" />
-            <UnmarshallingClass className="org.opensaml.xml.schema.impl.XSAnyUnmarshaller" />
-        </ObjectProvider>
-        
     </ObjectProviders>
 
 </XMLTooling>
\ No newline at end of file
diff --git a/src/test/java/org/openliberty/wsc/test/ClientLibTest.java b/src/test/java/org/openliberty/wsc/test/ClientLibTest.java
index c8fe928..b845832 100644
--- a/src/test/java/org/openliberty/wsc/test/ClientLibTest.java
+++ b/src/test/java/org/openliberty/wsc/test/ClientLibTest.java
@@ -1,16 +1,15 @@
 package org.openliberty.wsc.test;
 
-import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.UUID;
 
 import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 
+import net.shibboleth.utilities.java.support.security.SecureRandomIdentifierGenerationStrategy;
+
 import org.apache.log4j.Logger;
 import org.custommonkey.xmlunit.XMLTestCase;
 import org.joda.time.DateTime;
@@ -18,29 +17,25 @@ import org.openliberty.wsc.AuthenticationService;
 import org.openliberty.wsc.DiscoveryService;
 import org.openliberty.wsc.OpenLibertyBootstrap;
 import org.openliberty.wsc.PeopleService;
+import org.openliberty.wsc.PeopleService.ListStructure;
 import org.openliberty.wsc.PersonalProfileService;
 import org.openliberty.wsc.SSLUtilities;
 import org.openliberty.wsc.WSCException;
 import org.openliberty.wsc.WSCUtilities;
-import org.openliberty.wsc.PeopleService.ListStructure;
 import org.openliberty.xmltooling.Konstantz;
 import org.openliberty.xmltooling.OpenLibertyHelpers;
 import org.openliberty.xmltooling.dst2_1.DSTDate;
-import org.openliberty.xmltooling.dst2_1.DSTString;
 import org.openliberty.xmltooling.pp.Address;
 import org.openliberty.xmltooling.pp.AddressCard;
 import org.openliberty.xmltooling.pp.CommonName;
 import org.openliberty.xmltooling.pp.PP;
-import org.openliberty.xmltooling.pp.dst2_1.DSTDateTypeBuilder;
 import org.openliberty.xmltooling.pp.dst2_1.ct.CN;
 import org.openliberty.xmltooling.pp.dst2_1.ct.Nick;
 import org.openliberty.xmltooling.ps.DisplayName;
 import org.openliberty.xmltooling.ps.ObjectID;
-import org.openliberty.xmltooling.ps.ObjectRef;
 import org.openliberty.xmltooling.ps.PSObject;
 import org.openliberty.xmltooling.ps.Tag;
 import org.openliberty.xmltooling.ps.TargetObjectID;
-import org.openliberty.xmltooling.ps.request.AddKnownEntityRequest;
 import org.openliberty.xmltooling.ps.request.ListMembersRequest;
 import org.openliberty.xmltooling.ps.request.ResolveInput;
 import org.openliberty.xmltooling.ps.response.AddCollectionResponse;
@@ -55,14 +50,12 @@ import org.openliberty.xmltooling.ps.response.ResolveOutput;
 import org.openliberty.xmltooling.ps.response.SetObjectInfoResponse;
 import org.openliberty.xmltooling.ps.response.TestMembershipResponse;
 import org.openliberty.xmltooling.security.Token;
-import org.openliberty.xmltooling.security.TokenPolicy;
 import org.openliberty.xmltooling.utility_2_0.Extension;
 import org.openliberty.xmltooling.wsa.EndpointReference;
-import org.opensaml.common.impl.SecureRandomIdentifierGenerator;
-import org.opensaml.xml.ConfigurationException;
-import org.opensaml.xml.XMLObject;
-import org.opensaml.xml.schema.XSAny;
-import org.opensaml.xml.schema.impl.XSAnyBuilder;
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.config.XMLConfigurationException;
+import org.opensaml.core.xml.schema.XSAny;
+import org.opensaml.core.xml.schema.impl.XSAnyBuilder;
 
 
 /**
@@ -156,7 +149,7 @@ public class ClientLibTest extends XMLTestCase
 		{
 			OpenLibertyBootstrap.bootstrap();
 		}
-		catch(ConfigurationException e)
+		catch(XMLConfigurationException e)
 		{
 			fail(e.getMessage());
 			e.printStackTrace();            
@@ -172,7 +165,7 @@ public class ClientLibTest extends XMLTestCase
 	 * the best intentions.
 	 *      
 	 */
-	public void testMaster() throws WSCException
+	public void _testMaster() throws WSCException
 	{   
 		// Because we are testing against some implementations holding expired certificates, we set the ClientLib to ignore this fact.
 		OpenLibertyBootstrap.setCheckExpiry(false);
@@ -188,7 +181,7 @@ public class ClientLibTest extends XMLTestCase
 
 
 	/**
-	 * Testing various aspects of the client library with SYMLABS, Sampo Kellom�ki
+	 * Testing various aspects of the client library with SYMLABS, Sampo Kellom�ki
 	 * <p>
 	 * We are able to test AS, DISCO, and ID-DAP
 	 *
@@ -1006,16 +999,9 @@ public class ClientLibTest extends XMLTestCase
 	{
 		PSObject knownEntity = PSObject.createEntity("Asa's Buddy");
 		Token token = new Token();
-		SecureRandomIdentifierGenerator idGenerator;
-		try 
-		{
-			idGenerator = new SecureRandomIdentifierGenerator();
-			token.setId(idGenerator.generateIdentifier());
-		} 
-		catch (NoSuchAlgorithmException e) 
-		{
-			e.printStackTrace();
-		}  
+		SecureRandomIdentifierGenerationStrategy idGenerator = new SecureRandomIdentifierGenerationStrategy();
+		token.setId(idGenerator.generateIdentifier());
+		
 		token.setRef("http://www.google.com");
 		
 		XSAnyBuilder anyBuilder = new XSAnyBuilder();
diff --git a/src/test/java/org/openliberty/wsc/test/Demo.java b/src/test/java/org/openliberty/wsc/test/Demo.java
index bf14ced..a83d2ad 100644
--- a/src/test/java/org/openliberty/wsc/test/Demo.java
+++ b/src/test/java/org/openliberty/wsc/test/Demo.java
@@ -3,17 +3,17 @@ package org.openliberty.wsc.test;
 import java.util.List;
 import java.util.Scanner;
 
+import org.openliberty.wsc.AuthenticationService.AuthMechanism;
 import org.openliberty.wsc.DiscoveryService;
+import org.openliberty.wsc.DiscoveryService.WSFServiceType;
 import org.openliberty.wsc.OpenLibertyBootstrap;
 import org.openliberty.wsc.SSLUtilities;
 import org.openliberty.wsc.WSCException;
 import org.openliberty.wsc.WSCUtilities;
-import org.openliberty.wsc.AuthenticationService.AuthMechanism;
-import org.openliberty.wsc.DiscoveryService.WSFServiceType;
-import org.openliberty.xmltooling.OpenLibertyHelpers;
 import org.openliberty.xmltooling.Konstantz.WSFSecurityMechanism;
+import org.openliberty.xmltooling.OpenLibertyHelpers;
 import org.openliberty.xmltooling.wsa.EndpointReference;
-import org.opensaml.xml.ConfigurationException;
+import org.opensaml.core.xml.config.XMLConfigurationException;
 
 /**
  * This class demonstrates a simple path through the ID-WSF Client Library.  This demo
@@ -100,7 +100,7 @@ public class Demo
 
     }
 
-    public Demo() throws ConfigurationException
+    public Demo() throws XMLConfigurationException
     {
         // Load OpenLiberty Config Files
         OpenLibertyBootstrap.bootstrap();
diff --git a/src/test/java/org/openliberty/wsc/test/PeopleServiceTest.java b/src/test/java/org/openliberty/wsc/test/PeopleServiceTest.java
index a7f9100..84673ce 100644
--- a/src/test/java/org/openliberty/wsc/test/PeopleServiceTest.java
+++ b/src/test/java/org/openliberty/wsc/test/PeopleServiceTest.java
@@ -4,23 +4,22 @@ package org.openliberty.wsc.test;
 import java.util.List;
 import java.util.Scanner;
 
-import org.apache.log4j.Level;
+import org.openliberty.wsc.AuthenticationService.AuthMechanism;
 import org.openliberty.wsc.DiscoveryService;
+import org.openliberty.wsc.DiscoveryService.WSFServiceType;
 import org.openliberty.wsc.OpenLibertyBootstrap;
 import org.openliberty.wsc.PeopleService;
 import org.openliberty.wsc.SSLUtilities;
 import org.openliberty.wsc.WSCException;
 import org.openliberty.wsc.WSCUtilities;
 import org.openliberty.wsc.WSFMessage;
-import org.openliberty.wsc.AuthenticationService.AuthMechanism;
-import org.openliberty.wsc.DiscoveryService.WSFServiceType;
 import org.openliberty.xmltooling.Konstantz.WSFSecurityMechanism;
 import org.openliberty.xmltooling.disco.ServiceType;
 import org.openliberty.xmltooling.ps.PSObject;
 import org.openliberty.xmltooling.ps.Tag;
 import org.openliberty.xmltooling.ps.response.AddEntityResponse;
 import org.openliberty.xmltooling.wsa.EndpointReference;
-import org.opensaml.xml.ConfigurationException;
+import org.opensaml.core.xml.config.XMLConfigurationException;
 
 /**
  * This class demonstrates a simple path through the ID-WSF Client Library.  This demo
@@ -152,7 +151,7 @@ public class PeopleServiceTest
 
 
 
-	public PeopleServiceTest() throws ConfigurationException
+	public PeopleServiceTest() throws XMLConfigurationException
 	{
 		// Load OpenLiberty Config Files
 		OpenLibertyBootstrap.bootstrap();
diff --git a/src/test/resources/log4j.xml b/src/test/resources/log4j.xml
deleted file mode 100755
index 695361f..0000000
--- a/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!--                                                                       -->
-<!--  Log4j Configuration                                                  -->
-<!--                                                                       -->
-<!-- ===================================================================== -->
-
-<!--
-   | For more configuration infromation and examples see the Jakarta Log4j
-   | owebsite: http://jakarta.apache.org/log4j
- -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
-   <!-- ================================= -->
-   <!-- Preserve messages in a local file -->
-   <!-- ================================= -->
-
-   <!-- A time/date based rolling appender -->
-   <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
-      <param name="File" value="opensaml.log"/>
-      <param name="Append" value="false"/>
-
-      <!-- Rollover at midnight each day -->
-      <param name="DatePattern" value="'.'yyyy-MM-dd"/>
-
-      <layout class="org.apache.log4j.PatternLayout">
-         <!-- The default pattern: Date Priority [Category] Message\n -->
-         <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
-      </layout>
-      
-   </appender>
-
-   <!-- ============================== -->
-   <!-- Append messages to the console -->
-   <!-- ============================== -->
-
-   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-      <param name="Target" value="System.out"/>
-
-      <layout class="org.apache.log4j.PatternLayout">
-         <!-- The default pattern: Date Priority [Category] Message\n -->
-         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
-      </layout>
-   </appender>
-
-
-   <!-- ================ -->
-   <!-- Limit categories -->
-   <!-- ================ -->
-
-	<category name="org.openliberty.wsc.test">
-		<priority value="DEBUG"/>
-	</category>
-
-<!-- 
-	<category name="org.openliberty.wsc.DirectoryAccessProtocolService">
-		<priority value="DEBUG"/>
-	</category>
--->
-
- 
- <!-- 
-	<category name="org.openliberty.wsc.WSFMessage">
-		<priority value="DEBUG"/>
-	</category>
- -->
-  
-  <!-- 
-	<category name="org.openliberty.wsc.SSLUtilities">
-		<priority value="DEBUG"/>
-	</category>
-
-
-	<category name="org.openliberty.wsc.PersonalProfileService">
-		<priority value="DEBUG"/>
-	</category>
--->
-
-	<category name="org.openliberty.wsc.PeopleService">
-		<priority value="DEBUG"/>
-	</category>
-
-
-<!--
-	<category name="org.openliberty.wsc.AuthenticationService">
-		<priority value="DEBUG"/>
-	</category>
--->   
-
-<!--
-   	<category name="org.openliberty.xmltooling.idsis.dap">
-		<priority value="DEBUG"/>
-	</category>
--->   
-
-	<!--     
-   <category name="org.opensaml.xml.io.AbstractXMLObjectMarshaller">
-		<priority value="DEBUG"/>
-	</category>   
-   -->
-   
-   <category name="org.apache">
-      <priority value="WARN"/>
-   </category>
-
-   <!-- ======================= -->
-   <!-- Setup the Root category -->
-   <!-- ======================= -->
-
-   <root>
-      <priority value="WARN"/>
-      <appender-ref ref="CONSOLE"/>
-   </root>
-
-</log4j:configuration>
\ No newline at end of file
diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..8664012
--- /dev/null
+++ b/src/test/resources/logback-test.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%-5level %logger{0} - %msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+    </appender>
+    
+    <logger name="org.openliberty">
+        <level value="DEBUG"/>
+    </logger>
+    
+    <logger name="org.opensaml">
+        <level value="WARN"/>
+    </logger>
+    
+    <logger name="org.opensaml.core.xml.config.XMLConfigurator">
+        <level value="WARN"/>
+    </logger>
+    
+    <root>
+        <appender-ref ref="STDOUT"/>
+        <level value="WARN"/>
+    </root>
+    
+</configuration>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list