JBoss Identity SVN: r865 - in identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings: workflow and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-10-21 12:57:31 -0400 (Wed, 21 Oct 2009)
New Revision: 865
Added:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java
Removed:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockContextClassLoader.java
Modified:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/workflow/SAML2RedirectWorkflowUnitTestCase.java
Log:
JBID-40: workflow test
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaContextClassLoader.java 2009-10-21 16:57:31 UTC (rev 865)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.mock;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+/**
+ * Mock TCL
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 7, 2009
+ */
+public class MockCatalinaContextClassLoader extends URLClassLoader
+{
+ private String profile;
+
+ private ClassLoader delegate;
+
+ public MockCatalinaContextClassLoader(URL[] urls)
+ {
+ super(urls);
+ }
+
+ public void setDelegate(ClassLoader tcl)
+ {
+ this.delegate = tcl;
+ }
+
+ public void setProfile(String profile)
+ {
+ this.profile = profile;
+ }
+
+ @Override
+ public InputStream getResourceAsStream(String name)
+ {
+ if(profile == null)
+ throw new RuntimeException("null profile");
+ return delegate.getResourceAsStream(profile + "/" + name);
+ }
+}
\ No newline at end of file
Deleted: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockContextClassLoader.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockContextClassLoader.java 2009-10-21 16:56:32 UTC (rev 864)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockContextClassLoader.java 2009-10-21 16:57:31 UTC (rev 865)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.identity.federation.bindings.mock;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-/**
- * Mock TCL
- * @author Anil.Saldhana(a)redhat.com
- * @since Oct 7, 2009
- */
-public class MockContextClassLoader extends URLClassLoader
-{
- private String profile;
-
- private ClassLoader delegate;
-
- public MockContextClassLoader(URL[] urls)
- {
- super(urls);
- }
-
- public void setDelegate(ClassLoader tcl)
- {
- this.delegate = tcl;
- }
-
- public void setProfile(String profile)
- {
- this.profile = profile;
- }
-
- @Override
- public InputStream getResourceAsStream(String name)
- {
- if(profile == null)
- throw new RuntimeException("null profile");
- return delegate.getResourceAsStream(profile + "/" + name);
- }
-}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/workflow/SAML2RedirectWorkflowUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/workflow/SAML2RedirectWorkflowUnitTestCase.java 2009-10-21 16:56:32 UTC (rev 864)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/workflow/SAML2RedirectWorkflowUnitTestCase.java 2009-10-21 16:57:31 UTC (rev 865)
@@ -50,7 +50,7 @@
public void testSAML2Redirect() throws Exception
{
- MockContextClassLoader mclSPEmp = setupTCL(profile + "/sp/employee");
+ MockCatalinaContextClassLoader mclSPEmp = setupTCL(profile + "/sp/employee");
Thread.currentThread().setContextClassLoader(mclSPEmp);
SPRedirectFormAuthenticator sp = new SPRedirectFormAuthenticator();
@@ -88,7 +88,7 @@
roles.add("manager");
roles.add("employee");
- MockContextClassLoader mclIDP = setupTCL(profile + "/idp/");
+ MockCatalinaContextClassLoader mclIDP = setupTCL(profile + "/idp/");
Thread.currentThread().setContextClassLoader(mclIDP);
request = new MockCatalinaRequest();
@@ -137,11 +137,11 @@
assertTrue("Employee app auth success", sp.authenticate(request, response, loginConfig) );
}
- private MockContextClassLoader setupTCL(String resource)
+ private MockCatalinaContextClassLoader setupTCL(String resource)
{
URL[] urls = new URL[] {tcl.getResource(resource)};
- MockContextClassLoader mcl = new MockContextClassLoader(urls);
+ MockCatalinaContextClassLoader mcl = new MockCatalinaContextClassLoader(urls);
mcl.setDelegate(tcl);
mcl.setProfile(resource);
return mcl;
16 years, 9 months
JBoss Identity SVN: r864 - identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-10-21 12:56:32 -0400 (Wed, 21 Oct 2009)
New Revision: 864
Added:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockContextClassLoader.java
Log:
JBID-40: workflow test
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockContextClassLoader.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockContextClassLoader.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockContextClassLoader.java 2009-10-21 16:56:32 UTC (rev 864)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.mock;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+/**
+ * Mock TCL
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 7, 2009
+ */
+public class MockContextClassLoader extends URLClassLoader
+{
+ private String profile;
+
+ private ClassLoader delegate;
+
+ public MockContextClassLoader(URL[] urls)
+ {
+ super(urls);
+ }
+
+ public void setDelegate(ClassLoader tcl)
+ {
+ this.delegate = tcl;
+ }
+
+ public void setProfile(String profile)
+ {
+ this.profile = profile;
+ }
+
+ @Override
+ public InputStream getResourceAsStream(String name)
+ {
+ if(profile == null)
+ throw new RuntimeException("null profile");
+ return delegate.getResourceAsStream(profile + "/" + name);
+ }
+}
\ No newline at end of file
16 years, 9 months
JBoss Identity SVN: r863 - in identity-federation/trunk: jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp and 21 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-10-21 12:54:23 -0400 (Wed, 21 Oct 2009)
New Revision: 863
Added:
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaContext.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaLoginConfig.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaRealm.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaRequest.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaResponse.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaSession.java
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/workflow/
identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/workflow/SAML2RedirectWorkflowUnitTestCase.java
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/WEB-INF/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jbid-handlers.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/roles.properties
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jbid-handlers.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/roles.properties
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jbid-handlers.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/roles.properties
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/WEB-INF/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/WEB-INF/jbid-handlers.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/roles.properties
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/users.properties
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jbid-handlers.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/roles.properties
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java
identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java
Log:
JBID-40: workflow test
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2009-10-20 18:45:58 UTC (rev 862)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -278,7 +278,7 @@
}
catch (IssuerNotTrustedException e)
{
- if(trace) log.trace(e);
+ if(trace) log.trace("Exception in processing request:",e);
samlResponse =
webRequestUtil.getErrorResponse(referer,
@@ -287,7 +287,7 @@
}
catch (ParsingException e)
{
- if(trace) log.trace(e);
+ if(trace) log.trace("Exception in processing request:",e);
samlResponse =
webRequestUtil.getErrorResponse(referer,
@@ -296,7 +296,7 @@
}
catch (ConfigurationException e)
{
- if(trace) log.trace(e);
+ if(trace) log.trace("Exception in processing request:",e);
samlResponse =
webRequestUtil.getErrorResponse(referer,
@@ -305,7 +305,7 @@
}
catch (IssueInstantMissingException e)
{
- if(trace) log.trace(e);
+ if(trace) log.trace("Exception in processing request:",e);
samlResponse =
webRequestUtil.getErrorResponse(referer,
@@ -314,13 +314,22 @@
}
catch(GeneralSecurityException e)
{
- if(trace) log.trace(e);
+ if(trace) log.trace("Exception in processing request:", e);
samlResponse =
webRequestUtil.getErrorResponse(referer,
JBossSAMLURIConstants.STATUS_AUTHNFAILED.get(),
this.identityURL, this.signOutgoingMessages);
}
+ catch(Exception e)
+ {
+ if(trace) log.trace("Exception in processing request:",e);
+
+ samlResponse =
+ webRequestUtil.getErrorResponse(referer,
+ JBossSAMLURIConstants.STATUS_AUTHNFAILED.get(),
+ this.identityURL, this.signOutgoingMessages);
+ }
finally
{
try
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java 2009-10-20 18:45:58 UTC (rev 862)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -96,4 +96,22 @@
throw new RuntimeException(e);
}
}
+
+ public void testStart() throws LifecycleException
+ {
+ InputStream is = context.getServletContext().getResourceAsStream(configFile);
+ if(is == null)
+ throw new RuntimeException(configFile + " missing");
+ try
+ {
+ spConfiguration = ConfigurationUtil.getSPConfiguration(is);
+ this.identityURL = spConfiguration.getIdentityURL();
+ this.serviceURL = spConfiguration.getServiceURL();
+ if(trace) log.trace("Identity Provider URL=" + this.identityURL);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaContext.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaContext.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaContext.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,957 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.mock;
+
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.naming.directory.DirContext;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.catalina.Cluster;
+import org.apache.catalina.Context;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.ContainerListener;
+import org.apache.catalina.Loader;
+import org.apache.catalina.Manager;
+import org.apache.catalina.Pipeline;
+import org.apache.catalina.Realm;
+import org.apache.catalina.Wrapper;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.deploy.ApplicationParameter;
+import org.apache.catalina.deploy.ErrorPage;
+import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.deploy.FilterMap;
+import org.apache.catalina.deploy.LoginConfig;
+import org.apache.catalina.deploy.NamingResources;
+import org.apache.catalina.deploy.SecurityConstraint;
+import org.apache.catalina.util.CharsetMapper;
+import org.apache.juli.logging.Log;
+import org.apache.tomcat.util.http.mapper.Mapper;
+
+/**
+ * Mock Catalina Context
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+@SuppressWarnings("unchecked")
+public class MockCatalinaContext
+implements Context, Container, ServletContext
+{
+ private Realm realm;
+ public void addChild(Container arg0)
+ {
+ }
+
+ public void addContainerListener(ContainerListener arg0)
+ {
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener arg0)
+ {
+ }
+
+ public void backgroundProcess()
+ {
+ }
+
+ public Container findChild(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Container[] findChildren()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public ContainerListener[] findContainerListeners()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public int getBackgroundProcessorDelay()
+ {
+
+ return 0;
+ }
+
+ public Cluster getCluster()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public String getInfo()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Loader getLoader()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Log getLogger()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Manager getManager()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Object getMappingObject()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public String getName()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public String getObjectName()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Container getParent()
+ {
+ return this;
+ }
+
+ public ClassLoader getParentClassLoader()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Pipeline getPipeline()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public DirContext getResources()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void invoke(Request arg0, Response arg1) throws IOException, ServletException
+ {
+ }
+
+ public void removeChild(Container arg0)
+ {
+ }
+
+ public void removeContainerListener(ContainerListener arg0)
+ {
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener arg0)
+ {
+ }
+
+ public void setBackgroundProcessorDelay(int arg0)
+ {
+ }
+
+ public void setCluster(Cluster arg0)
+ {
+ }
+
+ public void setLoader(Loader arg0)
+ {
+ }
+
+ public void setManager(Manager arg0)
+ {
+ }
+
+ public void setName(String arg0)
+ {
+ }
+
+ public void setParent(Container arg0)
+ {
+ }
+
+ public void setParentClassLoader(ClassLoader arg0)
+ {
+ }
+
+ public void setRealm(Realm arg0)
+ {
+ this.realm = arg0;
+ }
+
+ public void setResources(DirContext arg0)
+ {
+ }
+
+ public void addApplicationListener(String arg0)
+ {
+ }
+
+ public void addApplicationParameter(ApplicationParameter arg0)
+ {
+ }
+
+ public void addConstraint(SecurityConstraint arg0)
+ {
+ }
+
+ public void addErrorPage(ErrorPage arg0)
+ {
+ }
+
+ public void addFilterDef(FilterDef arg0)
+ {
+ }
+
+ public void addFilterMap(FilterMap arg0)
+ {
+ }
+
+ public void addInstanceListener(String arg0)
+ {
+ }
+
+ public void addJspMapping(String arg0)
+ {
+ }
+
+ public void addLocaleEncodingMappingParameter(String arg0, String arg1)
+ {
+ }
+
+ public void addMimeMapping(String arg0, String arg1)
+ {
+ }
+
+ public void addParameter(String arg0, String arg1)
+ {
+ }
+
+ public void addRoleMapping(String arg0, String arg1)
+ {
+ }
+
+ public void addSecurityRole(String arg0)
+ {
+ }
+
+ public void addServletMapping(String arg0, String arg1)
+ {
+ }
+
+ public void addTaglib(String arg0, String arg1)
+ {
+ }
+
+ public void addWatchedResource(String arg0)
+ {
+ }
+
+ public void addWelcomeFile(String arg0)
+ {
+ }
+
+ public void addWrapperLifecycle(String arg0)
+ {
+ }
+
+ public void addWrapperListener(String arg0)
+ {
+ }
+
+ public Wrapper createWrapper()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findApplicationListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public ApplicationParameter[] findApplicationParameters()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public SecurityConstraint[] findConstraints()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public ErrorPage findErrorPage(int arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public ErrorPage findErrorPage(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public ErrorPage[] findErrorPages()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public FilterDef findFilterDef(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public FilterDef[] findFilterDefs()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public FilterMap[] findFilterMaps()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findInstanceListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findMimeMapping(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findMimeMappings()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findParameter(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findParameters()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findRoleMapping(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean findSecurityRole(String arg0)
+ {
+ return false;
+ }
+
+ public String[] findSecurityRoles()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findServletMapping(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findServletMappings()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findStatusPage(int arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public int[] findStatusPages()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String findTaglib(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findTaglibs()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findWatchedResources()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean findWelcomeFile(String arg0)
+ {
+ return false;
+ }
+
+ public String[] findWelcomeFiles()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findWrapperLifecycles()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] findWrapperListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getAltDDName()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Object[] getApplicationEventListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Object[] getApplicationLifecycleListeners()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getAvailable()
+ {
+ return false;
+ }
+
+ public CharsetMapper getCharsetMapper()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getConfigFile()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getConfigured()
+ {
+ return false;
+ }
+
+ public boolean getCookies()
+ {
+ return false;
+ }
+
+ public boolean getCrossContext()
+ {
+ return false;
+ }
+
+ public String getDisplayName()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getDistributable()
+ {
+ return false;
+ }
+
+ public String getDocBase()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getEncodedPath()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getIgnoreAnnotations()
+ {
+ return false;
+ }
+
+ public LoginConfig getLoginConfig()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Mapper getMapper()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public NamingResources getNamingResources()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getOverride()
+ {
+ return false;
+ }
+
+ public String getPath()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getPrivileged()
+ {
+ return false;
+ }
+
+ public String getPublicId()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getReloadable()
+ {
+ return false;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return this;
+ }
+
+ public int getSessionTimeout()
+ {
+ return 0;
+ }
+
+ public boolean getSwallowOutput()
+ {
+ return false;
+ }
+
+ public boolean getTldNamespaceAware()
+ {
+ return false;
+ }
+
+ public boolean getTldValidation()
+ {
+ return false;
+ }
+
+ public String getWrapperClass()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean getXmlNamespaceAware()
+ {
+ return false;
+ }
+
+ public boolean getXmlValidation()
+ {
+ return false;
+ }
+
+ public void reload()
+ {
+ }
+
+ public void removeApplicationListener(String arg0)
+ {
+ }
+
+ public void removeApplicationParameter(String arg0)
+ {
+ }
+
+ public void removeConstraint(SecurityConstraint arg0)
+ {
+ }
+
+ public void removeErrorPage(ErrorPage arg0)
+ {
+ }
+
+ public void removeFilterDef(FilterDef arg0)
+ {
+ }
+
+ public void removeFilterMap(FilterMap arg0)
+ {
+ }
+
+ public void removeInstanceListener(String arg0)
+ {
+ }
+
+ public void removeMimeMapping(String arg0)
+ {
+ }
+
+ public void removeParameter(String arg0)
+ {
+ }
+
+ public void removeRoleMapping(String arg0)
+ {
+ }
+
+ public void removeSecurityRole(String arg0)
+ {
+ }
+
+ public void removeServletMapping(String arg0)
+ {
+ }
+
+ public void removeTaglib(String arg0)
+ {
+ }
+
+ public void removeWatchedResource(String arg0)
+ {
+ }
+
+ public void removeWelcomeFile(String arg0)
+ {
+ }
+
+ public void removeWrapperLifecycle(String arg0)
+ {
+ }
+
+ public void removeWrapperListener(String arg0)
+ {
+ }
+
+ public void setAltDDName(String arg0)
+ {
+ }
+
+ public void setApplicationEventListeners(Object[] arg0)
+ {
+ }
+
+ public void setApplicationLifecycleListeners(Object[] arg0)
+ {
+ }
+
+ public void setAvailable(boolean arg0)
+ {
+ }
+
+ public void setCharsetMapper(CharsetMapper arg0)
+ {
+ }
+
+ public void setConfigFile(String arg0)
+ {
+ }
+
+ public void setConfigured(boolean arg0)
+ {
+ }
+
+ public void setCookies(boolean arg0)
+ {
+ }
+
+ public void setCrossContext(boolean arg0)
+ {
+ }
+
+ public void setDisplayName(String arg0)
+ {
+ }
+
+ public void setDistributable(boolean arg0)
+ {
+ }
+
+ public void setDocBase(String arg0)
+ {
+ }
+
+ public void setIgnoreAnnotations(boolean arg0)
+ {
+ }
+
+ public void setLoginConfig(LoginConfig arg0)
+ {
+ }
+
+ public void setNamingResources(NamingResources arg0)
+ {
+ }
+
+ public void setOverride(boolean arg0)
+ {
+ }
+
+ public void setPath(String arg0)
+ {
+ }
+
+ public void setPrivileged(boolean arg0)
+ {
+ }
+
+ public void setPublicId(String arg0)
+ {
+ }
+
+ public void setReloadable(boolean arg0)
+ {
+ }
+
+ public void setSessionTimeout(int arg0)
+ {
+ }
+
+ public void setSwallowOutput(boolean arg0)
+ {
+ }
+
+ public void setTldNamespaceAware(boolean arg0)
+ {
+ }
+
+ public void setTldValidation(boolean arg0)
+ {
+ }
+
+ public void setWrapperClass(String arg0)
+ {
+ }
+
+ public void setXmlNamespaceAware(boolean arg0)
+ {
+ }
+
+ public void setXmlValidation(boolean arg0)
+ {
+ }
+
+ public Realm getRealm()
+ {
+ return realm;
+ }
+
+
+ //Copied from MockServletContext
+ private Map params = new HashMap();
+ private Map attribs = new HashMap();
+
+ public Object getAttribute(String arg0)
+ {
+ return attribs.get(arg0);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return new Enumeration()
+ {
+ private Iterator iter = attribs.entrySet().iterator();
+
+ public boolean hasMoreElements()
+ {
+ return iter.hasNext();
+ }
+
+ public Object nextElement()
+ {
+ Entry<String,Object> entry = (Entry<String, Object>) iter.next();
+ return entry.getValue();
+ }
+ };
+ }
+
+ public ServletContext getContext(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getContextPath()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getInitParameter(String arg0)
+ {
+ return (String) params.get(arg0);
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ return new Enumeration()
+ {
+ private Iterator iter = params.entrySet().iterator();
+
+ public boolean hasMoreElements()
+ {
+ return iter.hasNext();
+ }
+
+ public Object nextElement()
+ {
+ Entry<String,Object> entry = (Entry<String, Object>) iter.next();
+ return entry.getKey();
+ }
+ };
+ }
+
+ public int getMajorVersion()
+ {
+ return 0;
+ }
+
+ public String getMimeType(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public int getMinorVersion()
+ {
+ return 0;
+ }
+
+ public RequestDispatcher getNamedDispatcher(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getRealPath(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0)
+ {
+ return new RequestDispatcher()
+ {
+
+ public void include(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException
+ {
+ }
+
+ public void forward(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException
+ {
+ }
+ };
+ }
+
+ public URL getResource(String arg0) throws MalformedURLException
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public InputStream getResourceAsStream(String arg0)
+ {
+ return Thread.currentThread().getContextClassLoader().getResourceAsStream(arg0);
+ }
+
+ public Set getResourcePaths(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getServerInfo()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Servlet getServlet(String arg0) throws ServletException
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getServletContextName()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Enumeration getServletNames()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Enumeration getServlets()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void log(String arg0)
+ {
+ }
+
+ public void log(Exception arg0, String arg1)
+ {
+ }
+
+ public void log(String arg0, Throwable arg1)
+ {
+ }
+
+ public void removeAttribute(String arg0)
+ {
+ this.attribs.remove(arg0);
+ }
+
+ public void setAttribute(String arg0, Object arg1)
+ {
+ this.attribs.put(arg0, arg1);
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaLoginConfig.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaLoginConfig.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaLoginConfig.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.mock;
+
+import org.apache.catalina.deploy.LoginConfig;
+
+/**
+ * Mock LoginConfig
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+public class MockCatalinaLoginConfig extends LoginConfig
+{
+ private static final long serialVersionUID = 1L;
+}
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaRealm.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaRealm.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaRealm.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.mock;
+
+import java.security.Principal;
+
+import org.apache.catalina.realm.RealmBase;
+
+/**
+ * Mock Tomcat Realm
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 21, 2009
+ */
+public class MockCatalinaRealm extends RealmBase
+{
+ private String name;
+ private String pass;
+ private Principal principal;
+
+ public MockCatalinaRealm(String name, String pass, Principal p)
+ {
+ this.name = name;
+ this.pass = pass;
+ this.principal = p;
+ }
+
+ @Override
+ protected String getName()
+ {
+ return name;
+ }
+
+ @Override
+ protected String getPassword(String arg0)
+ {
+ return pass;
+ }
+
+ @Override
+ protected Principal getPrincipal(String arg0)
+ {
+ return principal;
+ }
+
+ @Override
+ public Principal authenticate(String arg0, String arg1)
+ {
+ return principal;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaRequest.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaRequest.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaRequest.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.mock;
+
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.catalina.Session;
+import org.apache.catalina.connector.Request;
+
+/**
+ * Request for catalina container
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+public class MockCatalinaRequest extends Request
+{
+ private Map<String,String> params = new HashMap<String, String>();
+ private Map<String,String> headers = new HashMap<String, String>();
+ private Session session;
+ private Principal principal;
+ private String method;
+ private String remotee;
+ private String queryString;
+
+
+ @Override
+ public void addHeader(String name, String value)
+ {
+ this.headers.put(name, value);
+ }
+
+ @Override
+ public String getHeader(String name)
+ {
+ return headers.get(name);
+ }
+
+ @Override
+ public Principal getPrincipal()
+ {
+ return principal;
+ }
+
+ @Override
+ public void setUserPrincipal(Principal arg0)
+ {
+ this.principal = arg0;
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ return this.params.get(name);
+ }
+
+ public void setParameter(String key, String value)
+ {
+ params.put(key, value);
+ }
+
+ @Override
+ public String getQueryString()
+ {
+ return this.queryString;
+ }
+
+ @Override
+ public void setQueryString(String query)
+ {
+ this.queryString = query;
+ }
+
+ @Override
+ public String getRemoteAddr()
+ {
+ return this.remotee;
+ }
+
+ @Override
+ public void setRemoteAddr(String remoteAddr)
+ {
+ this.remotee = remoteAddr;
+ }
+
+ @Override
+ public String getMethod()
+ {
+ return this.method;
+ }
+
+ @Override
+ public void setMethod(String method)
+ {
+ this.method = method;
+ }
+
+ @Override
+ public Session getSessionInternal()
+ {
+ return session;
+ }
+
+ @Override
+ public Session getSessionInternal(boolean b)
+ {
+ return session;
+ }
+
+ public void setSession(Session s)
+ {
+ this.session = s;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaResponse.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaResponse.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaResponse.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.mock;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.catalina.connector.Response;
+
+/**
+ * Mock catalina response
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+public class MockCatalinaResponse extends Response
+{
+ private Map<String, String> headers = new HashMap<String, String>();
+ private int status;
+ public String redirectString;
+
+ @Override
+ public void setCharacterEncoding(String charset)
+ {
+ }
+
+ @Override
+ public void setHeader(String name, String value)
+ {
+ this.headers.put(name, value);
+ }
+
+ @Override
+ public int getStatus()
+ {
+ return this.status;
+ }
+
+ @Override
+ public void setStatus(int status)
+ {
+ this.status = status;
+ }
+
+ @Override
+ public void sendRedirect(String arg0) throws IOException
+ {
+ this.redirectString = arg0;
+ }
+
+ @Override
+ public boolean isCommitted()
+ {
+ return false;
+ }
+
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaSession.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaSession.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/mock/MockCatalinaSession.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,289 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.mock;
+
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.Map.Entry;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
+import org.apache.catalina.SessionListener;
+
+/**
+ * Mock session for the catalina infrastructure
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+@SuppressWarnings({"deprecation", "unchecked"})
+public class MockCatalinaSession implements Session, HttpSession
+{
+ private Map<String, Object> notes = new HashMap<String,Object>();
+
+ public void setMaxInactiveInterval(int arg0)
+ {
+ }
+
+ public void access()
+ {
+ }
+
+ public void addSessionListener(SessionListener arg0)
+ {
+ }
+
+ public void endAccess()
+ {
+ }
+
+ public void expire()
+ {
+ }
+
+ public String getAuthType()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getIdInternal()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String getInfo()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public long getLastAccessedTimeInternal()
+ {
+ return 0;
+ }
+
+ public Manager getManager()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public Object getNote(String arg0)
+ {
+ return notes.get(arg0);
+ }
+
+ public Iterator getNoteNames()
+ {
+ return notes.keySet().iterator();
+ }
+
+ public Principal getPrincipal()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public HttpSession getSession()
+ {
+ return this;
+ }
+
+ public boolean isValid()
+ {
+ return false;
+ }
+
+ public void recycle()
+ {
+ }
+
+ public void removeNote(String arg0)
+ {
+ }
+
+ public void removeSessionListener(SessionListener arg0)
+ {
+ }
+
+ public void setAuthType(String arg0)
+ {
+ }
+
+ public void setCreationTime(long arg0)
+ {
+ }
+
+ public void setId(String arg0)
+ {
+ }
+
+ public void setManager(Manager arg0)
+ {
+ }
+
+ public void setNew(boolean arg0)
+ {
+ }
+
+ public void setNote(String arg0, Object arg1)
+ {
+ this.notes.put(arg0, arg1);
+ }
+
+ public void setPrincipal(Principal arg0)
+ {
+ }
+
+ public void setValid(boolean arg0)
+ {
+ }
+
+ //Copied from MockHttpSession
+ private boolean valid = true;
+
+ private Map<String,Object> attribs = new HashMap<String,Object>();
+
+ private String id = UUID.randomUUID().toString();
+
+ private ServletContext context;
+
+ public boolean isInvalidated()
+ {
+ return valid == false;
+ }
+
+ public Object getAttribute(String arg0)
+ {
+ return attribs.get(arg0);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return new Enumeration()
+ {
+ private Iterator iter = attribs.entrySet().iterator();
+
+ public boolean hasMoreElements()
+ {
+ return iter.hasNext();
+ }
+
+ public Object nextElement()
+ {
+ Entry<String,Object> entry = (Entry<String, Object>) iter.next();
+ return entry.getValue();
+ }
+ };
+ }
+
+ public long getCreationTime()
+ {
+ return 0;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public long getLastAccessedTime()
+ {
+ return 0;
+ }
+
+ public int getMaxInactiveInterval()
+ {
+ return 0;
+ }
+
+ public void setServletContext(ServletContext servletContext)
+ {
+ this.context = servletContext;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return this.context;
+ }
+
+ public HttpSessionContext getSessionContext()
+ {
+
+ throw new RuntimeException("NYI");
+ }
+
+ public Object getValue(String arg0)
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public String[] getValueNames()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public void invalidate()
+ {
+ this.valid = false;
+ }
+
+ public boolean isNew()
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+
+ return false;
+ }
+
+ public void putValue(String arg0, Object arg1)
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+ }
+
+ public void removeAttribute(String arg0)
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+
+ this.attribs.remove(arg0);
+ }
+
+ public void removeValue(String arg0)
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+ }
+
+ public void setAttribute(String arg0, Object arg1)
+ {
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+
+ this.attribs.put(arg0, arg1);
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/workflow/SAML2RedirectWorkflowUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/workflow/SAML2RedirectWorkflowUnitTestCase.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/java/org/jboss/test/identity/federation/bindings/workflow/SAML2RedirectWorkflowUnitTestCase.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.bindings.workflow;
+
+import java.net.URL;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.catalina.realm.GenericPrincipal;
+import org.jboss.identity.federation.bindings.tomcat.idp.IDPWebBrowserSSOValve;
+import org.jboss.identity.federation.bindings.tomcat.sp.SPRedirectFormAuthenticator;
+import org.jboss.identity.federation.web.util.RedirectBindingUtil;
+import org.jboss.test.identity.federation.bindings.mock.*;
+
+/**
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 20, 2009
+ */
+public class SAML2RedirectWorkflowUnitTestCase extends TestCase
+{
+ private String profile = "saml2/logout";
+ private ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ private String employee = "http://localhost:8080/employee/";
+
+ private String SAML_REQUEST_KEY = "SAMLRequest=";
+
+ private String SAML_RESPONSE_KEY = "SAMLResponse=";
+
+ public void testSAML2Redirect() throws Exception
+ {
+ MockContextClassLoader mclSPEmp = setupTCL(profile + "/sp/employee");
+ Thread.currentThread().setContextClassLoader(mclSPEmp);
+
+ SPRedirectFormAuthenticator sp = new SPRedirectFormAuthenticator();
+
+ MockCatalinaContext context = new MockCatalinaContext();
+ MockCatalinaRequest request = new MockCatalinaRequest();
+
+ request.setParameter("RelayState", null);
+
+ MockCatalinaResponse response = new MockCatalinaResponse();
+ MockCatalinaLoginConfig loginConfig = new MockCatalinaLoginConfig();
+
+ sp.setContainer(context);
+ sp.testStart();
+
+ sp.authenticate(request, response, loginConfig);
+
+ String redirectStr = response.redirectString;
+ assertNotNull("Redirect String is null?", redirectStr);
+ String saml = RedirectBindingUtil.urlDecode(redirectStr.substring(redirectStr.indexOf(SAML_REQUEST_KEY) +
+ SAML_REQUEST_KEY.length()) );
+
+ MockCatalinaSession session = new MockCatalinaSession();
+
+ //Now send it to IDP
+ MockCatalinaRealm realm = new MockCatalinaRealm("anil", "test", new Principal()
+ {
+ public String getName()
+ {
+ return "anil";
+ }
+ });
+
+ List<String> roles = new ArrayList<String>();
+ roles.add("manager");
+ roles.add("employee");
+
+ MockContextClassLoader mclIDP = setupTCL(profile + "/idp/");
+ Thread.currentThread().setContextClassLoader(mclIDP);
+
+ request = new MockCatalinaRequest();
+ request.setRemoteAddr(employee);
+ request.setSession(session);
+ request.setParameter("SAMLRequest", saml);
+ request.setUserPrincipal(new GenericPrincipal(realm, "anil", "test", roles) );
+ request.setMethod("GET");
+
+ response = new MockCatalinaResponse();
+
+ IDPWebBrowserSSOValve idp = new IDPWebBrowserSSOValve();
+
+ idp.setSignOutgoingMessages(false);
+
+ idp.setContainer(context);
+ idp.start();
+ idp.invoke(request, response);
+
+ redirectStr = response.redirectString;
+ String samlResponse = RedirectBindingUtil.urlDecode(redirectStr.substring(redirectStr.indexOf(SAML_RESPONSE_KEY) +
+ SAML_RESPONSE_KEY.length()));
+
+ mclSPEmp = setupTCL(profile + "/sp/employee");
+ Thread.currentThread().setContextClassLoader(mclSPEmp);
+
+
+ sp = new SPRedirectFormAuthenticator();
+
+ context = new MockCatalinaContext();
+
+ context.setRealm(realm);
+ request = new MockCatalinaRequest();
+ request.setContext(context);
+
+ request.setParameter("SAMLResponse", samlResponse);
+ request.setParameter("RelayState", null);
+ request.setSession(session);
+
+ response = new MockCatalinaResponse();
+ loginConfig = new MockCatalinaLoginConfig();
+
+ sp.setContainer(context);
+ sp.testStart();
+
+ assertTrue("Employee app auth success", sp.authenticate(request, response, loginConfig) );
+ }
+
+ private MockContextClassLoader setupTCL(String resource)
+ {
+ URL[] urls = new URL[] {tcl.getResource(resource)};
+
+ MockContextClassLoader mcl = new MockContextClassLoader(urls);
+ mcl.setDelegate(tcl);
+ mcl.setProfile(resource);
+ return mcl;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jbid-handlers.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,5 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.RolesGenerationHandler"/>
+</Handlers>
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,9 @@
+<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager=""
+ RoleGenerator="org.jboss.identity.federation.core.impl.EmptyRoleGenerator">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<Trust>
+ <Domains>localhost,jboss.com,jboss.org</Domains>
+</Trust>
+
+</JBossIDP>
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/roles.properties
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/roles.properties (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/idp/roles.properties 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1 @@
+manager=manager
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jbid-handlers.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,3 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+</Handlers>
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/employee/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/roles.properties
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/roles.properties (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/employee/roles.properties 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1 @@
+manager=manager
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jbid-handlers.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,3 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+</Handlers>
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/sales/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/roles.properties
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/roles.properties (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/logout/sp/sales/roles.properties 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1 @@
+manager=manager
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/WEB-INF/jbid-handlers.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,5 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"/>
+</Handlers>
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,8 @@
+<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<Trust>
+ <Domains>localhost,jboss.com,jboss.org</Domains>
+</Trust>
+
+</JBossIDP>
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/roles.properties
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/roles.properties (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/roles.properties 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,2 @@
+manager=manager
+anil=manager,sales,employee
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/users.properties
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/users.properties (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/idp/users.properties 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1 @@
+anil=anil
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jbid-handlers.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,5 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"/>
+</Handlers>
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/employee/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/roles.properties
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/roles.properties (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings/src/test/resources/saml2/post/sp/employee/roles.properties 2009-10-21 16:54:23 UTC (rev 863)
@@ -0,0 +1 @@
+manager=manager
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java 2009-10-20 18:45:58 UTC (rev 862)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -149,7 +149,15 @@
SAML2Request saml2Request = new SAML2Request();
if(redirectProfile)
{
- is = RedirectBindingUtil.base64DeflateDecode(samlMessage);
+ try
+ {
+ is = RedirectBindingUtil.base64DeflateDecode(samlMessage);
+ }
+ catch(Exception e)
+ {
+ log.error("Exception in parsing saml message:", e);
+ throw new ParsingException();
+ }
}
else
{
Modified: identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java 2009-10-20 18:45:58 UTC (rev 862)
+++ identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java 2009-10-21 16:54:23 UTC (rev 863)
@@ -36,7 +36,8 @@
* Mock HttpSession
* @author Anil.Saldhana(a)redhat.com
* @since Oct 7, 2009
- */
+ */
+@SuppressWarnings({"deprecation", "unchecked"})
public class MockHttpSession implements HttpSession
{
private boolean valid = true;
16 years, 9 months
JBoss Identity SVN: r862 - in identity-federation/trunk/jboss-identity-fed-core: src/test/java/org/jboss/test/identity/federation/core/wstrust and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: beve
Date: 2009-10-20 14:45:58 -0400 (Tue, 20 Oct 2009)
New Revision: 862
Modified:
identity-federation/trunk/jboss-identity-fed-core/pom.xml
identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/STSClientUnitTestCase.java
Log:
Work for https://jira.jboss.org/jira/browse/JBID-203 "Remove test depencency on JBossXB from jboss-identity-fed-core"
Modified: identity-federation/trunk/jboss-identity-fed-core/pom.xml
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/pom.xml 2009-10-14 05:02:06 UTC (rev 861)
+++ identity-federation/trunk/jboss-identity-fed-core/pom.xml 2009-10-20 18:45:58 UTC (rev 862)
@@ -114,12 +114,6 @@
<version>2.2.14.GA</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <version>2.0.1.GA</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<reporting>
Modified: identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/STSClientUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/STSClientUnitTestCase.java 2009-10-14 05:02:06 UTC (rev 861)
+++ identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/STSClientUnitTestCase.java 2009-10-20 18:45:58 UTC (rev 862)
@@ -225,6 +225,9 @@
public void testIssue_Neither_AppliesTo_Or_TokenType_Specified()
{
+ if(usetest == false)
+ return;
+
Builder stsConfigBuilder = new STSClientConfig.Builder();
stsConfigBuilder.serviceName("JBossSTS");
stsConfigBuilder.portName("JBossSTSPort");
@@ -235,7 +238,7 @@
try
{
client.issueToken(null, null);
- fail("issueTokenForEndpoint shoud throw an exception if endpointURI and tokenType are null");
+ fail("issueTokenForEndpoint should throw an exception if endpointURI and tokenType are null");
}
catch(Exception e)
{
16 years, 9 months
JBoss Identity SVN: r861 - in identity-federation/trunk/jboss-identity-webapps: sales-standalone/src/main/webapp and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-10-14 01:02:06 -0400 (Wed, 14 Oct 2009)
New Revision: 861
Added:
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/jbid-handlers.xml
identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/WEB-INF/jbid-handlers.xml
Modified:
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/web.xml
identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/index.jsp
Log:
JBID:40: saml logout
Added: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/jbid-handlers.xml 2009-10-14 05:02:06 UTC (rev 861)
@@ -0,0 +1,5 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"/>
+ </Handlers>
Modified: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/web.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/web.xml 2009-10-14 04:50:17 UTC (rev 860)
+++ identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/web.xml 2009-10-14 05:02:06 UTC (rev 861)
@@ -9,6 +9,12 @@
IDP Standalone Application
</description>
+ <!-- Listeners -->
+ <listener>
+ <listener-class>org.jboss.identity.federation.web.core.IdentityServer</listener-class>
+ </listener>
+
+
<!-- Create the servlet -->
<servlet>
<servlet-name>IDPLoginServlet</servlet-name>
Added: identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/WEB-INF/jbid-handlers.xml 2009-10-14 05:02:06 UTC (rev 861)
@@ -0,0 +1,5 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"/>
+</Handlers>
Modified: identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/index.jsp
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/index.jsp 2009-10-14 04:50:17 UTC (rev 860)
+++ identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/index.jsp 2009-10-14 05:02:06 UTC (rev 861)
@@ -9,5 +9,5 @@
<img src="piechart.gif"/>
<br/>
-<a href="logout.jsp">Click to LogOut</a>
+<a href="?GLO=true">Click to LogOut</a>
</div>
16 years, 9 months
JBoss Identity SVN: r860 - in identity-federation/trunk: jboss-identity-web/src/main/java/org/jboss/identity/federation/web/core and 3 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-10-14 00:50:17 -0400 (Wed, 14 Oct 2009)
New Revision: 860
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2HandlerResponse.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/core/IdentityServer.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java
identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java
identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/workflow/saml2/SAML2LogoutWorkflowUnitTestCase.java
identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/workflow/saml2/SAML2PostWorkflowUnitTestCase.java
Log:
JBID:40: saml logout
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2HandlerResponse.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2HandlerResponse.java 2009-10-14 04:37:39 UTC (rev 859)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2HandlerResponse.java 2009-10-14 04:50:17 UTC (rev 860)
@@ -109,7 +109,15 @@
*/
String getErrorMessage();
+ /**
+ * Will the resulting document be a SAMLRequest?
+ * @param request
+ */
void setSendRequest(boolean request);
+ /**
+ * @see #setSendRequest(boolean)
+ * @return
+ */
boolean getSendRequest();
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/core/IdentityServer.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/core/IdentityServer.java 2009-10-14 04:37:39 UTC (rev 859)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/core/IdentityServer.java 2009-10-14 04:50:17 UTC (rev 860)
@@ -201,7 +201,10 @@
IdentityServer idserver = (IdentityServer) servletContext.getAttribute(GeneralConstants.IDENTITY_SERVER);
if(idserver == null)
+ {
+ idserver = this;
servletContext.setAttribute(GeneralConstants.IDENTITY_SERVER, this);
+ }
if(idserver != this)
throw new IllegalStateException("Identity Server mismatch");
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java 2009-10-14 04:37:39 UTC (rev 859)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java 2009-10-14 04:50:17 UTC (rev 860)
@@ -190,7 +190,7 @@
throw new ProcessingException(e);
}
- httpSession.invalidate();
+ httpSession.invalidate(); //We are done with the logout interaction
}
else
{
Modified: identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java 2009-10-14 04:37:39 UTC (rev 859)
+++ identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java 2009-10-14 04:50:17 UTC (rev 860)
@@ -44,6 +44,8 @@
private Map<String,Object> attribs = new HashMap<String,Object>();
private String id = UUID.randomUUID().toString();
+
+ private ServletContext context;
public boolean isInvalidated()
{
@@ -94,9 +96,14 @@
return 0;
}
+ public void setServletContext(ServletContext servletContext)
+ {
+ this.context = servletContext;
+ }
+
public ServletContext getServletContext()
{
- throw new RuntimeException("NYI");
+ return this.context;
}
public HttpSessionContext getSessionContext()
Modified: identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/workflow/saml2/SAML2LogoutWorkflowUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/workflow/saml2/SAML2LogoutWorkflowUnitTestCase.java 2009-10-14 04:37:39 UTC (rev 859)
+++ identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/workflow/saml2/SAML2LogoutWorkflowUnitTestCase.java 2009-10-14 04:50:17 UTC (rev 860)
@@ -92,6 +92,7 @@
ServletContext servletContext = new MockServletContext();
+ session.setServletContext(servletContext);
//Let us feed the LogOutRequest to the SPFilter
MockContextClassLoader mclSPEmp = setupTCL(profile + "/sp/employee");
@@ -134,6 +135,8 @@
Thread.currentThread().setContextClassLoader(mclIDP);
ServletContext servletContext = new MockServletContext();
+ session.setServletContext(servletContext);
+
IdentityServer server = this.getIdentityServer(session);
servletContext.setAttribute("IDENTITY_SERVER", server);
MockServletConfig servletConfig = new MockServletConfig(servletContext);
Modified: identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/workflow/saml2/SAML2PostWorkflowUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/workflow/saml2/SAML2PostWorkflowUnitTestCase.java 2009-10-14 04:37:39 UTC (rev 859)
+++ identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/workflow/saml2/SAML2PostWorkflowUnitTestCase.java 2009-10-14 04:50:17 UTC (rev 860)
@@ -110,6 +110,7 @@
MockHttpSession session = new MockHttpSession();
servletContext = new MockServletContext();
+ session.setServletContext(servletContext);
IdentityServer server = this.getIdentityServer(session);
servletContext.setAttribute("IDENTITY_SERVER", server);
MockServletConfig servletConfig = new MockServletConfig(servletContext);
16 years, 9 months
JBoss Identity SVN: r859 - in identity-federation/trunk: jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/impl and 6 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-10-14 00:37:39 -0400 (Wed, 14 Oct 2009)
New Revision: 859
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/impl/DefaultSAML2HandlerResponse.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2HandlerResponse.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/core/IdentityServer.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/filters/SPFilter.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPLoginServlet.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/PostBindingUtil.java
Log:
JBID:40: saml logout
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -204,9 +204,9 @@
if(this.signOutgoingMessages)
webRequestUtil.send(samlErrorResponse, referer, relayState, response, true,
- this.keyManager.getSigningKey());
+ this.keyManager.getSigningKey(), false);
else
- webRequestUtil.send(samlErrorResponse, referer,relayState, response, false,null);
+ webRequestUtil.send(samlErrorResponse, referer,relayState, response, false,null, false);
}
catch (GeneralSecurityException e)
@@ -330,9 +330,9 @@
if(this.signOutgoingMessages)
webRequestUtil.send(samlResponse, destination,relayState, response, true,
- this.keyManager.getSigningKey());
+ this.keyManager.getSigningKey(), false);
else
- webRequestUtil.send(samlResponse, destination, relayState, response, false,null);
+ webRequestUtil.send(samlResponse, destination, relayState, response, false,null, false);
}
catch (ParsingException e)
{
@@ -377,9 +377,9 @@
if(this.signOutgoingMessages)
webRequestUtil.send(samlResponse, referrer, relayState, response, true,
- this.keyManager.getSigningKey());
+ this.keyManager.getSigningKey(), false);
else
- webRequestUtil.send(samlResponse, referrer, relayState, response, false,null);
+ webRequestUtil.send(samlResponse, referrer, relayState, response, false,null, false);
}
catch (ParsingException e1)
{
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/impl/DefaultSAML2HandlerResponse.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/impl/DefaultSAML2HandlerResponse.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/impl/DefaultSAML2HandlerResponse.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -41,6 +41,9 @@
private int errorCode;
private String errorMessage;
private boolean errorMode;
+ private boolean sendRequest;
+
+
/**
* @see SAML2HandlerResponse#getRelayState()
@@ -140,4 +143,14 @@
{
return this.errorMode;
}
+
+ public boolean getSendRequest()
+ {
+ return this.sendRequest;
+ }
+
+ public void setSendRequest(boolean request)
+ {
+ this.sendRequest = request;
+ }
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2HandlerResponse.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2HandlerResponse.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2HandlerResponse.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -108,4 +108,8 @@
* @return
*/
String getErrorMessage();
+
+ void setSendRequest(boolean request);
+
+ boolean getSendRequest();
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/core/IdentityServer.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/core/IdentityServer.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/core/IdentityServer.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -26,9 +26,13 @@
import java.util.Stack;
import java.util.concurrent.ConcurrentHashMap;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
+import org.jboss.identity.federation.web.constants.GeneralConstants;
+
/**
* Represents an Identity Server
* @author Anil.Saldhana(a)redhat.com
@@ -68,7 +72,7 @@
{
String result = null;
Stack<String> stack = sessionParticipantsMap.get(sessionID);
- if(stack != null)
+ if(stack != null && stack.isEmpty() == false)
{
result = stack.pop();
}
@@ -83,6 +87,11 @@
public void register(String sessionID, String participant)
{
Stack<String> stack = sessionParticipantsMap.get(sessionID);
+ if(stack == null)
+ {
+ stack = new Stack<String>();
+ sessionParticipantsMap.put(sessionID, stack );
+ }
if(stack.contains(participant) == false)
stack.push(participant);
}
@@ -110,6 +119,11 @@
public boolean registerTransitParticipant(String sessionID, String participant)
{
Set<String> transitSet = inTransitMap.get(sessionID);
+ if(transitSet == null)
+ {
+ transitSet = new HashSet<String>();
+ inTransitMap.put(sessionID, transitSet);
+ }
if(transitSet != null)
return transitSet.add(participant);
return false;
@@ -180,6 +194,18 @@
*/
public void sessionCreated(HttpSessionEvent sessionEvent)
{
+ HttpSession session = sessionEvent.getSession();
+ //Ensure that the IdentityServer instance is set on the servlet context
+ ServletContext servletContext = session.getServletContext();
+
+ IdentityServer idserver = (IdentityServer) servletContext.getAttribute(GeneralConstants.IDENTITY_SERVER);
+
+ if(idserver == null)
+ servletContext.setAttribute(GeneralConstants.IDENTITY_SERVER, this);
+
+ if(idserver != this)
+ throw new IllegalStateException("Identity Server mismatch");
+
String id = sessionEvent.getSession().getId();
stack.put(id);
}
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/filters/SPFilter.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/filters/SPFilter.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/filters/SPFilter.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -241,7 +241,8 @@
{
try
{
- this.sendToDestination(samlResponseDocument, relayState, destination, response);
+ this.sendToDestination(samlResponseDocument, relayState, destination, response,
+ saml2HandlerResponse.getSendRequest());
}
catch (Exception e)
{
@@ -272,6 +273,9 @@
byte[] base64DecodedResponse = PostBindingUtil.base64Decode(samlResponse);
InputStream is = new ByteArrayInputStream(base64DecodedResponse);
+ //Are we going to send Request to IDP?
+ boolean willSendRequest = true;
+
try
{
SAML2Response saml2Response = new SAML2Response();
@@ -301,6 +305,7 @@
if(samlObject instanceof RequestAbstractType)
{
handler.handleRequestType(saml2HandlerRequest, saml2HandlerResponse);
+ willSendRequest = false;
}
else
{
@@ -317,7 +322,7 @@
if(destination != null &&
samlResponseDocument != null)
{
- this.sendToDestination(samlResponseDocument, relayState, destination, response);
+ this.sendToDestination(samlResponseDocument, relayState, destination, response, willSendRequest);
return;
}
/*ResponseType responseType = saml2Response.getResponseType(is);
@@ -380,8 +385,77 @@
log.trace("AssertionExpiredException:", e);
throw new ServletException("Assertion expired Exception");
} */
- }
+ }
+ if(isNotNull(samlRequest))
+ {
+ //we got a logout request
+
+ //deal with SAML response from IDP
+ byte[] base64DecodedRequest = PostBindingUtil.base64Decode(samlRequest);
+ InputStream is = new ByteArrayInputStream(base64DecodedRequest);
+
+ //Are we going to send Request to IDP?
+ boolean willSendRequest = false;
+
+ try
+ {
+ SAML2Request saml2Request = new SAML2Request();
+ SAML2Object samlObject = saml2Request.getSAML2ObjectFromStream(is);
+ SAMLDocumentHolder documentHolder = saml2Request.getSamlDocumentHolder();
+
+ Set<SAML2Handler> handlers = chain.handlers();
+ IssuerInfoHolder holder = new IssuerInfoHolder(this.serviceURL);
+ ProtocolContext protocolContext = new HTTPContext(request,response, context);
+ //Create the request/response
+ SAML2HandlerRequest saml2HandlerRequest =
+ new DefaultSAML2HandlerRequest(protocolContext,
+ holder.getIssuer(), documentHolder,
+ HANDLER_TYPE.SP);
+
+ SAML2HandlerResponse saml2HandlerResponse = new DefaultSAML2HandlerResponse();
+
+ //Deal with handler chains
+ for(SAML2Handler handler : handlers)
+ {
+ if(saml2HandlerResponse.isInError())
+ {
+ response.sendError(saml2HandlerResponse.getErrorCode());
+ break;
+ }
+ if(samlObject instanceof RequestAbstractType)
+ {
+ handler.handleRequestType(saml2HandlerRequest, saml2HandlerResponse);
+ willSendRequest = false;
+ }
+ else
+ {
+ handler.handleStatusResponseType(saml2HandlerRequest, saml2HandlerResponse);
+ }
+ }
+
+ Document samlResponseDocument = saml2HandlerResponse.getResultingDocument();
+ String relayState = saml2HandlerResponse.getRelayState();
+
+ String destination = saml2HandlerResponse.getDestination();
+
+
+ if(destination != null &&
+ samlResponseDocument != null)
+ {
+ this.sendToDestination(samlResponseDocument, relayState, destination, response, willSendRequest);
+ return;
+ }
+ }
+ catch (Exception e)
+ {
+ if(trace)
+ log.trace("Server Exception:", e);
+ throw new ServletException("Server Exception");
+ }
+
+ }
+
}
}
@@ -526,7 +600,8 @@
protected void sendToDestination(Document samlDocument, String relayState,
String destination,
- HttpServletResponse response)
+ HttpServletResponse response,
+ boolean request)
throws IOException, SAXException, JAXBException,GeneralSecurityException
{
String samlMessage;
@@ -543,7 +618,7 @@
throw new ProcessingException(e);
}
PostBindingUtil.sendPost(new DestinationInfoHolder(destination, samlMessage, relayState),
- response, true);
+ response, request);
}
protected boolean validate(HttpServletRequest request) throws IOException, GeneralSecurityException
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.Map;
+import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
@@ -58,6 +59,7 @@
import org.jboss.identity.federation.saml.v2.protocol.StatusType;
import org.jboss.identity.federation.web.constants.GeneralConstants;
import org.jboss.identity.federation.web.core.HTTPContext;
+import org.jboss.identity.federation.web.core.IdentityServer;
import org.jboss.identity.federation.web.interfaces.IRoleValidator;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -140,6 +142,9 @@
public void handleRequestType( SAML2HandlerRequest request,
SAML2HandlerResponse response ) throws ProcessingException
{
+ HTTPContext httpContext = (HTTPContext) request.getContext();
+ ServletContext servletContext = httpContext.getServletContext();
+
AuthnRequestType art = (AuthnRequestType) request.getSAML2Object();
HttpSession session = BaseSAML2Handler.getHttpSession(request);
Principal userPrincipal = (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID);
@@ -154,12 +159,17 @@
attribs,
assertionValidity);
+ //Update the Identity Server
+ IdentityServer identityServer = (IdentityServer) servletContext.getAttribute(GeneralConstants.IDENTITY_SERVER);
+ identityServer.stack().register(session.getId(), destination);
+
response.setDestination(destination);
response.setResultingDocument(samlResponse);
}
catch(Exception e)
{
- throw new ProcessingException(e);
+ log.error("Exception in processing authentication:", e);
+ throw new ProcessingException("authentication issue");
}
}
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -189,6 +189,8 @@
{
throw new ProcessingException(e);
}
+
+ httpSession.invalidate();
}
else
{
@@ -205,6 +207,7 @@
{
LogoutRequestType lort = saml2Request.createLogoutRequest(request.getIssuer().getValue());
response.setResultingDocument(saml2Request.convert(lort));
+ response.setSendRequest(true);
}
catch(Exception e)
{
@@ -246,6 +249,7 @@
generateSuccessStatusResponseType(logOutRequest.getID(),
request, response, originalIssuer);
+ response.setSendRequest(false);
}
else
{
@@ -263,6 +267,7 @@
LogoutRequestType lort = saml2Request.createLogoutRequest(request.getIssuer().getValue());
response.setResultingDocument(saml2Request.convert(lort));
+ response.setSendRequest(true);
}
}
catch(ParserConfigurationException pe)
@@ -364,6 +369,7 @@
LogoutRequestType lot =
samlRequest.createLogoutRequest(request.getIssuer().getValue());
response.setResultingDocument(samlRequest.convert(lot));
+ response.setSendRequest(true);
}
catch (Exception e)
{
@@ -451,6 +457,7 @@
response.setRelayState(relayState);
response.setDestination(logOutRequest.getIssuer().getValue());
+ response.setSendRequest(false);
}
}
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPLoginServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPLoginServlet.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPLoginServlet.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -146,6 +146,8 @@
{
//Save the SAMLRequest and relayState
session.setAttribute("SAMLRequest", request.getParameter("SAMLRequest"));
+ session.setAttribute("SAMLResponse", request.getParameter("SAMLResponse"));
+
String relayState = request.getParameter("RelayState");
if(relayState != null && !"".equals(relayState))
session.setAttribute("RelayState", relayState );
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -127,6 +127,7 @@
super.init(config);
String configFile = "/WEB-INF/jboss-idfed.xml";
context = config.getServletContext();
+
InputStream is = context.getResourceAsStream(configFile);
if(is == null)
throw new RuntimeException(configFile + " missing");
@@ -221,6 +222,8 @@
}
}
+ //The Identity Server on the servlet context gets set
+ //in the implementation of IdentityServer
//Create an Identity Server and set it on the context
IdentityServer identityServer = (IdentityServer) context.getAttribute(GeneralConstants.IDENTITY_SERVER);
if(identityServer == null)
@@ -260,6 +263,8 @@
webRequestUtil.setAttributeManager(this.attribManager);
webRequestUtil.setAttributeKeys(attributeKeys);
+ boolean willSendRequest = true;
+
if(userPrincipal != null)
{
if(trace)
@@ -321,6 +326,7 @@
{
handler.reset();
handler.handleStatusResponseType(saml2HandlerRequest, saml2HandlerResponse);
+ willSendRequest = saml2HandlerResponse.getSendRequest();
}
}
}
@@ -402,6 +408,7 @@
for(SAML2Handler handler: handlers)
{
handler.handleRequestType(saml2HandlerRequest, saml2HandlerResponse);
+ willSendRequest = saml2HandlerResponse.getSendRequest();
}
}
}
@@ -519,9 +526,9 @@
if(this.signOutgoingMessages)
webRequestUtil.send(samlResponse, destination,relayState, response, true,
- this.keyManager.getSigningKey());
+ this.keyManager.getSigningKey(), willSendRequest);
else
- webRequestUtil.send(samlResponse, destination, relayState, response, false,null);
+ webRequestUtil.send(samlResponse, destination, relayState, response, false,null, willSendRequest);
}
catch (ParsingException e)
{
@@ -548,9 +555,9 @@
{
if(this.signOutgoingMessages)
webRequestUtil.send(samlResponse, referrer, relayState, response, true,
- this.keyManager.getSigningKey());
+ this.keyManager.getSigningKey(), false);
else
- webRequestUtil.send(samlResponse, referrer, relayState, response, false,null);
+ webRequestUtil.send(samlResponse, referrer, relayState, response, false,null, false);
}
catch (ParsingException e1)
{
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -321,7 +321,8 @@
String relayState,
HttpServletResponse response,
boolean supportSignature,
- PrivateKey signingKey) throws IOException, GeneralSecurityException
+ PrivateKey signingKey,
+ boolean sendRequest) throws IOException, GeneralSecurityException
{
if(responseDoc == null)
throw new IllegalArgumentException("responseType is null");
@@ -359,7 +360,7 @@
String samlResponse = PostBindingUtil.base64Encode(new String(responseBytes));
PostBindingUtil.sendPost(new DestinationInfoHolder(destination,
- samlResponse, relayState), response, false);
+ samlResponse, relayState), response, sendRequest);
}
}
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/PostBindingUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/PostBindingUtil.java 2009-10-13 23:16:21 UTC (rev 858)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/PostBindingUtil.java 2009-10-14 04:37:39 UTC (rev 859)
@@ -60,10 +60,10 @@
*/
public static void sendPost(DestinationInfoHolder holder,
HttpServletResponse response,
- boolean sendToIDP)
+ boolean request)
throws IOException
{
- String key = sendToIDP ? "SAMLRequest" : "SAMLResponse";
+ String key = request ? "SAMLRequest" : "SAMLResponse";
String relayState = holder.getRelayState();
String destination = holder.getDestination();
@@ -79,10 +79,10 @@
builder.append("<HTML>");
builder.append("<HEAD>");
- if(sendToIDP)
- builder.append("<TITLE>HTTP Post Binding To Identity Provider</TITLE>");
+ if(request)
+ builder.append("<TITLE>HTTP Post Binding (Request)</TITLE>");
else
- builder.append("<TITLE>HTTP Post Binding Response To Service Provider</TITLE>");
+ builder.append("<TITLE>HTTP Post Binding Response (Response)</TITLE>");
builder.append("</HEAD>");
builder.append("<BODY Onload=\"document.forms[0].submit()\">");
16 years, 9 months
JBoss Identity SVN: r858 - identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-10-13 19:16:21 -0400 (Tue, 13 Oct 2009)
New Revision: 858
Modified:
identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java
Log:
update mock object
Modified: identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java 2009-10-13 23:06:42 UTC (rev 857)
+++ identity-federation/trunk/jboss-identity-web/src/test/java/org/jboss/test/identity/federation/web/mock/MockHttpSession.java 2009-10-13 23:16:21 UTC (rev 858)
@@ -75,8 +75,7 @@
}
public long getCreationTime()
- {
-
+ {
return 0;
}
@@ -86,20 +85,17 @@
}
public long getLastAccessedTime()
- {
-
+ {
return 0;
}
public int getMaxInactiveInterval()
- {
-
+ {
return 0;
}
public ServletContext getServletContext()
- {
-
+ {
throw new RuntimeException("NYI");
}
@@ -126,24 +122,37 @@
public boolean isNew()
{
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+
return false;
}
public void putValue(String arg0, Object arg1)
{
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
}
public void removeAttribute(String arg0)
{
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+
this.attribs.remove(arg0);
}
public void removeValue(String arg0)
{
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
}
public void setAttribute(String arg0, Object arg1)
{
+ if(this.valid == false)
+ throw new IllegalStateException("Session already invalidated");
+
this.attribs.put(arg0, arg1);
}
16 years, 9 months
JBoss Identity SVN: r857 - in identity-federation/trunk: jboss-identity-web/src/main/java/org/jboss/identity/federation/web/constants and 3 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-10-13 19:06:42 -0400 (Tue, 13 Oct 2009)
New Revision: 857
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatAttributeManager.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/constants/GeneralConstants.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/filters/SPFilter.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java
Log:
JBID:40: saml logout
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatAttributeManager.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatAttributeManager.java 2009-10-13 23:05:03 UTC (rev 856)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatAttributeManager.java 2009-10-13 23:06:42 UTC (rev 857)
@@ -22,6 +22,7 @@
package org.jboss.identity.federation.bindings.tomcat;
import java.security.Principal;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -41,6 +42,6 @@
public Map<String, Object> getAttributes(Principal userPrincipal,
List<String> attributeKeys)
{
- throw new RuntimeException("Not Implemented");
+ return new HashMap<String, Object>();
}
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/constants/GeneralConstants.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/constants/GeneralConstants.java 2009-10-13 23:05:03 UTC (rev 856)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/constants/GeneralConstants.java 2009-10-13 23:06:42 UTC (rev 857)
@@ -38,10 +38,13 @@
String GLOBAL_LOGOUT = "GLO";
+ String IDENTITY_SERVER = "IDENTITY_SERVER";
String IGNORE_SIGNATURES = "IGNORE_SIGNATURES";
String KEYPAIR = "KEYPAIR";
+ String LOGOUT_PAGE = "LOGOUT_PAGE";
+
String PRINCIPAL_ID = "jboss_identity.principal";
String ROLES = "ROLES";
String ROLES_ID = "jboss_identity.roles";
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/filters/SPFilter.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/filters/SPFilter.java 2009-10-13 23:05:03 UTC (rev 856)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/filters/SPFilter.java 2009-10-13 23:06:42 UTC (rev 857)
@@ -39,6 +39,7 @@
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
+import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
@@ -132,6 +133,8 @@
protected boolean ignoreSignatures = false;
private IRoleValidator roleValidator = new DefaultRoleValidator();
+
+ private String logOutPage = "/logout.jsp";
public void destroy()
{
@@ -153,7 +156,11 @@
String samlRequest = request.getParameter("SAMLRequest");
String samlResponse = request.getParameter("SAMLResponse");
- if(!postMethod)
+ //Eagerly look for Global LogOut
+ String gloStr = request.getParameter(GeneralConstants.GLOBAL_LOGOUT);
+ boolean logOutRequest = isNotNull(gloStr) && "true".equalsIgnoreCase(gloStr);
+
+ if(!postMethod && !logOutRequest)
{
//Check if we are already authenticated
if(userPrincipal != null)
@@ -210,9 +217,9 @@
{
response.sendError(saml2HandlerResponse.getErrorCode());
break;
- }
- String glo = request.getParameter(GeneralConstants.GLOBAL_LOGOUT);
- if(isNotNull(glo) && "true".equalsIgnoreCase(glo))
+ }
+
+ if(logOutRequest)
saml2HandlerRequest.setTypeOfRequestToBeGenerated(GENERATE_REQUEST_TYPE.LOGOUT);
else
saml2HandlerRequest.setTypeOfRequestToBeGenerated(GENERATE_REQUEST_TYPE.AUTH);
@@ -338,6 +345,21 @@
if(userPrincipal == null)
response.sendError(HttpServletResponse.SC_FORBIDDEN);*/
+ //See if the session has been invalidated
+ try
+ {
+ session.isNew();
+ }
+ catch(IllegalStateException ise)
+ {
+ //we are invalidated.
+ RequestDispatcher dispatch = context.getRequestDispatcher(this.logOutPage);
+ if(dispatch == null)
+ log.error("Cannot dispatch to the logout page: no request dispatcher:" + this.logOutPage);
+ else
+ dispatch.forward(request, response);
+ return;
+ }
filterChain.doFilter(request, servletResponse);
}
catch (Exception e)
@@ -381,6 +403,31 @@
{
throw new RuntimeException(e);
}
+
+ //Get the Role Validator if configured
+ String roleValidatorName = filterConfig.getInitParameter(GeneralConstants.ROLE_VALIDATOR);
+ if(roleValidatorName != null && !"".equals(roleValidatorName))
+ {
+ try
+ {
+ Class<?> clazz = SecurityActions.getContextClassLoader().loadClass(roleValidatorName);
+ this.roleValidator = (IRoleValidator) clazz.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ Map<String,String> options = new HashMap<String, String>();
+ String roles = filterConfig.getInitParameter(GeneralConstants.ROLES);
+ if(trace)
+ log.trace("Found Roles in SPFilter config="+roles);
+ if(roles != null)
+ {
+ options.put("ROLES", roles);
+ }
+ this.roleValidator.intialize(options);
//Get the chain from config
chain = new DefaultSAML2HandlerChain();
@@ -392,6 +439,7 @@
Map<String, Object> chainConfigOptions = new HashMap<String, Object>();
chainConfigOptions.put(GeneralConstants.CONFIGURATION, spConfiguration);
+ chainConfigOptions.put(GeneralConstants.ROLE_VALIDATOR, roleValidator);
SAML2HandlerChainConfig handlerChainConfig = new DefaultSAML2HandlerChainConfig(chainConfigOptions);
Set<SAML2Handler> samlHandlers = chain.handlers();
@@ -437,30 +485,10 @@
log.trace("Key Provider=" + keyProvider.getClassName());
}
- //Get the Role Validator if configured
- String roleValidatorName = filterConfig.getInitParameter(GeneralConstants.ROLE_VALIDATOR);
- if(roleValidatorName != null && !"".equals(roleValidatorName))
- {
- try
- {
- Class<?> clazz = SecurityActions.getContextClassLoader().loadClass(roleValidatorName);
- this.roleValidator = (IRoleValidator) clazz.newInstance();
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- Map<String,String> options = new HashMap<String, String>();
- String roles = filterConfig.getInitParameter(GeneralConstants.ROLES);
- if(trace)
- log.trace("Found Roles in SPFilter config="+roles);
- if(roles != null)
- {
- options.put("ROLES", roles);
- }
- this.roleValidator.intialize(options);
+ //see if a global logout page has been configured
+ String gloPage = filterConfig.getInitParameter(GeneralConstants.LOGOUT_PAGE);
+ if(gloPage != null && !"".equals(gloPage))
+ this.logOutPage = gloPage;
}
/**
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java 2009-10-13 23:05:03 UTC (rev 856)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2LogOutHandler.java 2009-10-13 23:06:42 UTC (rev 857)
@@ -49,6 +49,7 @@
import org.jboss.identity.federation.saml.v2.protocol.StatusCodeType;
import org.jboss.identity.federation.saml.v2.protocol.StatusResponseType;
import org.jboss.identity.federation.saml.v2.protocol.StatusType;
+import org.jboss.identity.federation.web.constants.GeneralConstants;
import org.jboss.identity.federation.web.core.HTTPContext;
import org.jboss.identity.federation.web.core.IdentityServer;
import org.xml.sax.SAXException;
@@ -228,7 +229,7 @@
SAML2Request saml2Request = new SAML2Request();
ServletContext servletCtx = httpContext.getServletContext();
- IdentityServer server = (IdentityServer)servletCtx.getAttribute("IDENTITY_SERVER");
+ IdentityServer server = (IdentityServer)servletCtx.getAttribute(GeneralConstants.IDENTITY_SERVER);
if(server == null)
throw new ProcessingException("Identity Server not found");
Modified: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java 2009-10-13 23:05:03 UTC (rev 856)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java 2009-10-13 23:06:42 UTC (rev 857)
@@ -75,6 +75,7 @@
import org.jboss.identity.federation.saml.v2.protocol.StatusResponseType;
import org.jboss.identity.federation.web.constants.GeneralConstants;
import org.jboss.identity.federation.web.core.HTTPContext;
+import org.jboss.identity.federation.web.core.IdentityServer;
import org.jboss.identity.federation.web.roles.DefaultRoleGenerator;
import org.jboss.identity.federation.web.util.ConfigurationUtil;
import org.jboss.identity.federation.web.util.IDPWebRequestUtil;
@@ -219,6 +220,14 @@
this.attributeKeys.add(st.nextToken());
}
}
+
+ //Create an Identity Server and set it on the context
+ IdentityServer identityServer = (IdentityServer) context.getAttribute(GeneralConstants.IDENTITY_SERVER);
+ if(identityServer == null)
+ {
+ identityServer = new IdentityServer();
+ context.setAttribute(GeneralConstants.IDENTITY_SERVER, identityServer);
+ }
}
16 years, 9 months
JBoss Identity SVN: r856 - in identity-federation/trunk/jboss-identity-webapps: idp-sig-no-val/src/main/webapp/WEB-INF and 3 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-10-13 19:05:03 -0400 (Tue, 13 Oct 2009)
New Revision: 856
Modified:
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/jboss-idfed.xml
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/jboss-idfed.xml
identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF/jboss-idfed.xml
identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/WEB-INF/jboss-idfed.xml
identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp/WEB-INF/jboss-idfed.xml
Log:
update the KeyStoreKeyManager location
Modified: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/jboss-idfed.xml 2009-10-13 08:13:13 UTC (rev 855)
+++ identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/jboss-idfed.xml 2009-10-13 23:05:03 UTC (rev 856)
@@ -3,7 +3,7 @@
<Trust>
<Domains>localhost,jboss.com,jboss.org,redhat.com</Domains>
</Trust>
-<KeyProvider ClassName="org.jboss.identity.federation.bindings.tomcat.KeyStoreKeyManager">
+<KeyProvider ClassName="org.jboss.identity.federation.core.impl.KeyStoreKeyManager">
<Auth Key="KeyStoreURL" Value="/jbid_test_keystore.jks" />
<Auth Key="KeyStorePass" Value="store123" />
<Auth Key="SigningKeyPass" Value="test123" />
Modified: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/jboss-idfed.xml 2009-10-13 08:13:13 UTC (rev 855)
+++ identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/jboss-idfed.xml 2009-10-13 23:05:03 UTC (rev 856)
@@ -3,7 +3,7 @@
<Trust>
<Domains>localhost,jboss.com,jboss.org,redhat.com</Domains>
</Trust>
-<KeyProvider ClassName="org.jboss.identity.federation.bindings.tomcat.KeyStoreKeyManager">
+<KeyProvider ClassName="org.jboss.identity.federation.core.impl.KeyStoreKeyManager">
<Auth Key="KeyStoreURL" Value="/jbid_test_keystore.jks" />
<Auth Key="KeyStorePass" Value="store123" />
<Auth Key="SigningKeyPass" Value="test123" />
Modified: identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF/jboss-idfed.xml 2009-10-13 08:13:13 UTC (rev 855)
+++ identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF/jboss-idfed.xml 2009-10-13 23:05:03 UTC (rev 856)
@@ -6,7 +6,7 @@
<Trust>
<Domains>localhost,jboss.com,jboss.org</Domains>
</Trust>
- <KeyProvider ClassName="org.jboss.identity.federation.bindings.tomcat.KeyStoreKeyManager">
+ <KeyProvider ClassName="org.jboss.identity.federation.core.impl.KeyStoreKeyManager">
<Auth Key="KeyStoreURL" Value="jbid_test_keystore.jks" />
<Auth Key="KeyStorePass" Value="store123" />
<Auth Key="SigningKeyPass" Value="test123" />
Modified: identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/WEB-INF/jboss-idfed.xml 2009-10-13 08:13:13 UTC (rev 855)
+++ identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/WEB-INF/jboss-idfed.xml 2009-10-13 23:05:03 UTC (rev 856)
@@ -1,7 +1,7 @@
<JBossSP xmlns="urn:jboss:identity-federation:config:1.0" ServerEnvironment="tomcat">
<IdentityURL>http://localhost:8080/idp-sig/</IdentityURL>
<ServiceURL>http://localhost:8080/sales-post-sig/</ServiceURL>
- <KeyProvider ClassName="org.jboss.identity.federation.bindings.tomcat.KeyStoreKeyManager">
+ <KeyProvider ClassName="org.jboss.identity.federation.core.impl.KeyStoreKeyManager">
<Auth Key="KeyStoreURL" Value="/jbid_test_keystore.jks" />
<Auth Key="KeyStorePass" Value="store123" />
<Auth Key="SigningKeyPass" Value="test123" />
Modified: identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp/WEB-INF/jboss-idfed.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp/WEB-INF/jboss-idfed.xml 2009-10-13 08:13:13 UTC (rev 855)
+++ identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp/WEB-INF/jboss-idfed.xml 2009-10-13 23:05:03 UTC (rev 856)
@@ -1,7 +1,7 @@
<JBossSP xmlns="urn:jboss:identity-federation:config:1.0" ServerEnvironment="tomcat">
<IdentityURL>http://localhost:8080/idp-sig/</IdentityURL>
<ServiceURL>http://localhost:8080/sales-sig/</ServiceURL>
- <KeyProvider ClassName="org.jboss.identity.federation.bindings.tomcat.KeyStoreKeyManager">
+ <KeyProvider ClassName="org.jboss.identity.federation.core.impl.KeyStoreKeyManager">
<Auth Key="KeyStoreURL" Value="jbid_test_keystore.jks" />
<Auth Key="KeyStorePass" Value="store123" />
<Auth Key="SigningKeyPass" Value="test123" />
16 years, 9 months