Author: anil.saldhana(a)jboss.com
Date: 2011-06-13 16:01:45 -0400 (Mon, 13 Jun 2011)
New Revision: 989
Added:
social/trunk/openid/src/test/resources/openid/webapp/test-sts.xml
Modified:
social/trunk/openid/src/main/java/org/picketlink/social/openid/servlets/OpenIDConsumerServlet.java
social/trunk/openid/src/main/java/org/picketlink/social/openid/servlets/OpenIDProviderServlet.java
social/trunk/openid/src/main/java/org/picketlink/social/openid/web/HTTPProtocolAdaptor.java
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/InMemoryProtocolAdapter.java
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/integration/LocalProviderOpenIDUnitTestCase.java
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/integration/YadisMetadataUnitTestCase.java
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/workflow/OpenIDWorkflowTestConsumerServlet.java
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/workflow/OpenIDWorkflowUnitTestCase.java
Log:
openid code migration
Modified:
social/trunk/openid/src/main/java/org/picketlink/social/openid/servlets/OpenIDConsumerServlet.java
===================================================================
---
social/trunk/openid/src/main/java/org/picketlink/social/openid/servlets/OpenIDConsumerServlet.java 2011-06-13
19:09:04 UTC (rev 988)
+++
social/trunk/openid/src/main/java/org/picketlink/social/openid/servlets/OpenIDConsumerServlet.java 2011-06-13
20:01:45 UTC (rev 989)
@@ -31,14 +31,15 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.picketlink.identity.federation.api.openid.OpenIDManager;
-import org.picketlink.identity.federation.api.openid.OpenIDRequest;
-import
org.picketlink.identity.federation.api.openid.OpenIDManager.OpenIDProviderInformation;
-import org.picketlink.identity.federation.api.openid.OpenIDManager.OpenIDProviderList;
-import org.picketlink.identity.federation.api.openid.exceptions.OpenIDGeneralException;
-import org.picketlink.identity.federation.web.openid.HTTPOpenIDContext;
-import org.picketlink.identity.federation.web.openid.HTTPProtocolAdaptor;
+import org.picketlink.social.openid.api.OpenIDManager;
+import org.picketlink.social.openid.api.OpenIDManager.OpenIDProviderInformation;
+import org.picketlink.social.openid.api.OpenIDManager.OpenIDProviderList;
+import org.picketlink.social.openid.api.OpenIDRequest;
+import org.picketlink.social.openid.api.exceptions.OpenIDGeneralException;
+import org.picketlink.social.openid.web.HTTPOpenIDContext;
+import org.picketlink.social.openid.web.HTTPProtocolAdaptor;
+
/**
* OpenID Consumer Servlet that gets a post
* request from the main JSP page of the consumer
Modified:
social/trunk/openid/src/main/java/org/picketlink/social/openid/servlets/OpenIDProviderServlet.java
===================================================================
---
social/trunk/openid/src/main/java/org/picketlink/social/openid/servlets/OpenIDProviderServlet.java 2011-06-13
19:09:04 UTC (rev 988)
+++
social/trunk/openid/src/main/java/org/picketlink/social/openid/servlets/OpenIDProviderServlet.java 2011-06-13
20:01:45 UTC (rev 989)
@@ -22,6 +22,7 @@
package org.picketlink.social.openid.servlets;
import java.io.IOException;
+import java.net.MalformedURLException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
@@ -62,8 +63,24 @@
String secpageStr = this.servletContext.getInitParameter("securePage");
if(secpageStr != null && secpageStr.length() > 0)
securePageName = secpageStr;
+
+ String configFile = null;
+ String configFileStr =
this.servletContext.getInitParameter("configFile");
+ if(configFileStr != null && configFileStr.length() > 0)
+ {
+ try
+ {
+ configFile = servletContext.getResource(configFileStr).toExternalForm();
+ }
+ catch (MalformedURLException e)
+ {
+ throw new ServletException(e);
+ }
+ }
+
+ log("configFile="+configFile);
- sts.installDefaultConfiguration( ( String[] )null );
+ sts.installDefaultConfiguration( new String[] {configFile} );
}
@Override
Modified:
social/trunk/openid/src/main/java/org/picketlink/social/openid/web/HTTPProtocolAdaptor.java
===================================================================
---
social/trunk/openid/src/main/java/org/picketlink/social/openid/web/HTTPProtocolAdaptor.java 2011-06-13
19:09:04 UTC (rev 988)
+++
social/trunk/openid/src/main/java/org/picketlink/social/openid/web/HTTPProtocolAdaptor.java 2011-06-13
20:01:45 UTC (rev 989)
@@ -30,15 +30,15 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.log4j.Logger;
-import org.picketlink.identity.federation.api.openid.OpenIDAttributeMap;
-import org.picketlink.identity.federation.api.openid.OpenIDLifecycle;
-import org.picketlink.identity.federation.api.openid.OpenIDLifecycleEvent;
-import org.picketlink.identity.federation.api.openid.OpenIDProtocolAdapter;
-import org.picketlink.identity.federation.api.openid.OpenIDLifecycleEvent.OP;
-import org.picketlink.identity.federation.api.openid.OpenIDLifecycleEvent.TYPE;
-import
org.picketlink.identity.federation.api.openid.exceptions.OpenIDLifeCycleException;
-import org.picketlink.identity.federation.api.openid.exceptions.OpenIDProtocolException;
+import org.apache.log4j.Logger;
+import org.picketlink.social.openid.api.OpenIDAttributeMap;
+import org.picketlink.social.openid.api.OpenIDLifecycle;
+import org.picketlink.social.openid.api.OpenIDLifecycleEvent;
+import org.picketlink.social.openid.api.OpenIDLifecycleEvent.OP;
+import org.picketlink.social.openid.api.OpenIDLifecycleEvent.TYPE;
+import org.picketlink.social.openid.api.OpenIDProtocolAdapter;
+import org.picketlink.social.openid.api.exceptions.OpenIDLifeCycleException;
+import org.picketlink.social.openid.api.exceptions.OpenIDProtocolException;
/**
* Protocol adapter for HTTP
Modified:
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/InMemoryProtocolAdapter.java
===================================================================
---
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/InMemoryProtocolAdapter.java 2011-06-13
19:09:04 UTC (rev 988)
+++
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/InMemoryProtocolAdapter.java 2011-06-13
20:01:45 UTC (rev 989)
@@ -24,12 +24,12 @@
import java.net.URL;
import java.util.Map;
-import org.picketlink.identity.federation.api.openid.OpenIDAttributeMap;
-import org.picketlink.identity.federation.api.openid.OpenIDLifecycle;
-import org.picketlink.identity.federation.api.openid.OpenIDLifecycleEvent;
-import org.picketlink.identity.federation.api.openid.OpenIDProtocolAdapter;
-import
org.picketlink.identity.federation.api.openid.exceptions.OpenIDLifeCycleException;
-import org.picketlink.identity.federation.api.openid.exceptions.OpenIDProtocolException;
+import org.picketlink.social.openid.api.OpenIDAttributeMap;
+import org.picketlink.social.openid.api.OpenIDLifecycle;
+import org.picketlink.social.openid.api.OpenIDLifecycleEvent;
+import org.picketlink.social.openid.api.OpenIDProtocolAdapter;
+import org.picketlink.social.openid.api.exceptions.OpenIDLifeCycleException;
+import org.picketlink.social.openid.api.exceptions.OpenIDProtocolException;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.WebConversation;
Modified:
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/integration/LocalProviderOpenIDUnitTestCase.java
===================================================================
---
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/integration/LocalProviderOpenIDUnitTestCase.java 2011-06-13
19:09:04 UTC (rev 988)
+++
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/integration/LocalProviderOpenIDUnitTestCase.java 2011-06-13
20:01:45 UTC (rev 989)
@@ -28,11 +28,11 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
-import org.picketlink.identity.federation.api.openid.OpenIDManager;
-import org.picketlink.identity.federation.api.openid.OpenIDRequest;
-import
org.picketlink.identity.federation.api.openid.OpenIDManager.OpenIDProviderInformation;
-import org.picketlink.identity.federation.api.openid.OpenIDManager.OpenIDProviderList;
+
+import org.picketlink.social.openid.api.OpenIDManager;
+import org.picketlink.social.openid.api.OpenIDManager.OpenIDProviderInformation;
+import org.picketlink.social.openid.api.OpenIDManager.OpenIDProviderList;
+import org.picketlink.social.openid.api.OpenIDRequest;
import org.picketlink.test.social.openid.EmbeddedWebServerBase;
import org.picketlink.test.social.openid.InMemoryProtocolAdapter;
import org.mortbay.jetty.servlet.Context;
Modified:
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/integration/YadisMetadataUnitTestCase.java
===================================================================
---
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/integration/YadisMetadataUnitTestCase.java 2011-06-13
19:09:04 UTC (rev 988)
+++
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/integration/YadisMetadataUnitTestCase.java 2011-06-13
20:01:45 UTC (rev 989)
@@ -27,10 +27,10 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
-import org.picketlink.identity.federation.api.openid.OpenIDManager;
-import org.picketlink.identity.federation.api.openid.OpenIDRequest;
-import org.picketlink.identity.federation.api.openid.OpenIDManager.OpenIDProviderList;
+
+import org.picketlink.social.openid.api.OpenIDManager;
+import org.picketlink.social.openid.api.OpenIDManager.OpenIDProviderList;
+import org.picketlink.social.openid.api.OpenIDRequest;
import org.picketlink.social.openid.servlets.OpenIDYadisServlet;
import org.picketlink.test.social.openid.EmbeddedWebServerBase;
import org.mortbay.jetty.servlet.Context;
Modified:
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/workflow/OpenIDWorkflowTestConsumerServlet.java
===================================================================
---
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/workflow/OpenIDWorkflowTestConsumerServlet.java 2011-06-13
19:09:04 UTC (rev 988)
+++
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/workflow/OpenIDWorkflowTestConsumerServlet.java 2011-06-13
20:01:45 UTC (rev 989)
@@ -28,9 +28,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.picketlink.identity.federation.api.openid.OpenIDManager;
-import org.picketlink.identity.federation.web.openid.HTTPOpenIDContext;
-import org.picketlink.identity.federation.web.openid.HTTPProtocolAdaptor;
+import org.picketlink.social.openid.api.OpenIDManager;
+import org.picketlink.social.openid.web.HTTPOpenIDContext;
+import org.picketlink.social.openid.web.HTTPProtocolAdaptor;
+
/**
* Test Consumer Servlet
Modified:
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/workflow/OpenIDWorkflowUnitTestCase.java
===================================================================
---
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/workflow/OpenIDWorkflowUnitTestCase.java 2011-06-13
19:09:04 UTC (rev 988)
+++
social/trunk/openid/src/test/java/org/picketlink/test/social/openid/workflow/OpenIDWorkflowUnitTestCase.java 2011-06-13
20:01:45 UTC (rev 989)
@@ -22,14 +22,16 @@
package org.picketlink.test.social.openid.workflow;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.jetty.webapp.WebAppContext;
-import org.picketlink.identity.federation.api.openid.OpenIDManager;
-import
org.picketlink.identity.federation.api.openid.OpenIDManager.OpenIDProviderInformation;
-import org.picketlink.identity.federation.api.openid.OpenIDManager.OpenIDProviderList;
-import org.picketlink.identity.federation.api.openid.OpenIDRequest;
+import org.mortbay.jetty.webapp.WebAppContext;
+import org.picketlink.social.openid.api.OpenIDManager;
+import org.picketlink.social.openid.api.OpenIDManager.OpenIDProviderInformation;
+import org.picketlink.social.openid.api.OpenIDManager.OpenIDProviderList;
+import org.picketlink.social.openid.api.OpenIDRequest;
import org.picketlink.social.openid.servlets.OpenIDProviderServlet;
import org.picketlink.test.social.openid.EmbeddedWebServerBase;
import org.picketlink.test.social.openid.InMemoryProtocolAdapter;
@@ -46,6 +48,7 @@
private OpenIDRequest openIDRequest = new OpenIDRequest( username );
private OpenIDManager manager = new OpenIDManager( openIDRequest );
+ @SuppressWarnings({"unchecked", "rawtypes"})
protected void establishUserApps()
{
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
@@ -60,6 +63,12 @@
Context context = new WebAppContext( warUrlString, CONTEXTPATH );
server.setHandler( context );
+
+ Map initParams = new HashMap();
+ initParams.put("configFile", "/test-sts.xml");
+ context.setInitParams(initParams);
+
+ Thread.currentThread().setContextClassLoader(context.getClassLoader());
context.addServlet(new ServletHolder(new OpenIDProviderServlet()),
"/provider/");
Added: social/trunk/openid/src/test/resources/openid/webapp/test-sts.xml
===================================================================
--- social/trunk/openid/src/test/resources/openid/webapp/test-sts.xml
(rev 0)
+++ social/trunk/openid/src/test/resources/openid/webapp/test-sts.xml 2011-06-13 20:01:45
UTC (rev 989)
@@ -0,0 +1,12 @@
+<PicketLinkSTS xmlns="urn:picketlink:identity-federation:config:1.0"
+ STSName="PicketLinkCoreSTS" TokenTimeout="7200"
EncryptToken="false">
+ <TokenProviders>
+ <TokenProvider
ProviderClass="org.picketlink.identity.federation.core.saml.v2.providers.SAML20AssertionTokenProvider"
+ TokenType="urn:oasis:names:tc:SAML:2.0:assertion"
+ TokenElement="Assertion"
+ TokenElementNS="urn:oasis:names:tc:SAML:2.0:assertion"/>
+ <TokenProvider
ProviderClass="org.picketlink.social.openid.providers.OpenIDTokenProvider"
+ TokenType="urn:openid:1:0"
+ TokenElementNS="urn:openid:1:0"/>
+ </TokenProviders>
+</PicketLinkSTS>
\ No newline at end of file
Show replies by date