Author: mposolda
Date: 2012-01-19 04:28:24 -0500 (Thu, 19 Jan 2012)
New Revision: 1343
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPPostFormAuthenticator.java
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaResponse.java
Log:
PLFED-255 method authenticate should return false when being redirected to Identity
Provider
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPPostFormAuthenticator.java
===================================================================
---
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPPostFormAuthenticator.java 2012-01-17
12:03:40 UTC (rev 1342)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPPostFormAuthenticator.java 2012-01-19
09:28:24 UTC (rev 1343)
@@ -193,6 +193,10 @@
requestProcessor.setSupportSignatures(supportSignatures);
boolean result = requestProcessor.process(samlRequest, httpContext, handlers,
chainLock);
+ // If response is already commited, we need to stop with processing of HTTP
request
+ if (response.isCommitted() || response.isAppCommitted())
+ return false;
+
if (result)
return result;
}
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java
===================================================================
---
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java 2012-01-17
12:03:40 UTC (rev 1342)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java 2012-01-19
09:28:24 UTC (rev 1343)
@@ -185,6 +185,10 @@
this.serviceURL);
boolean result = requestProcessor.process(samlRequest, httpContext, handlers,
chainLock);
+ // If response is already commited, we need to stop with processing of HTTP
request
+ if (response.isCommitted() || response.isAppCommitted())
+ return false;
+
if (result)
return result;
}
Modified:
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaResponse.java
===================================================================
---
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaResponse.java 2012-01-17
12:03:40 UTC (rev 1342)
+++
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/mock/MockCatalinaResponse.java 2012-01-19
09:28:24 UTC (rev 1343)
@@ -29,6 +29,8 @@
import org.apache.catalina.connector.Response;
+import javax.servlet.http.HttpServletResponse;
+
/**
* Mock catalina response
* @author Anil.Saldhana(a)redhat.com
@@ -75,7 +77,14 @@
{
return false;
}
-
+
+ @Override
+ public boolean isAppCommitted()
+ {
+ boolean redirected = getStatus() == HttpServletResponse.SC_MOVED_TEMPORARILY;
+ return redirected;
+ }
+
public void setWriter(Writer w)
{
this.mywriter = (PrintWriter) w;