Author: anil.saldhana(a)jboss.com
Date: 2011-01-27 12:47:31 -0500 (Thu, 27 Jan 2011)
New Revision: 675
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java
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/workflow/SAML2PostTomcatWorkflowUnitTestCase.java
federation/trunk/picketlink-fed-api/src/test/resources/log4j.xml
Log:
PLFED-128:save/restore req
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java
===================================================================
---
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java 2011-01-27
17:15:07 UTC (rev 674)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java 2011-01-27
17:47:31 UTC (rev 675)
@@ -78,6 +78,8 @@
protected Map<String, Object> chainConfigOptions = new HashMap<String,
Object>();
+ //Whether the authenticator has to to save and restore request
+ protected boolean saveRestoreRequest = true;
/**
* A Lock for Handler operations in the chain
@@ -106,8 +108,13 @@
public void setSamlHandlerChainClass(String samlHandlerChainClass)
{
this.samlHandlerChainClass = samlHandlerChainClass;
+ }
+
+ public void setSaveRestoreRequest(boolean saveRestoreRequest)
+ {
+ this.saveRestoreRequest = saveRestoreRequest;
}
-
+
/**
* Perform validation os the request object
* @param request
@@ -149,6 +156,7 @@
//Mock test purpose
public void testStart() throws LifecycleException
{
+ this.saveRestoreRequest = false;
processStart();
}
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 2011-01-27
17:15:07 UTC (rev 674)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPPostFormAuthenticator.java 2011-01-27
17:47:31 UTC (rev 675)
@@ -76,7 +76,7 @@
protected boolean supportSignatures = false;
- protected TrustKeyManager keyManager;
+ protected TrustKeyManager keyManager;
/**
* A flag to indicate that we are going to validate signature
@@ -89,7 +89,7 @@
super();
ServerDetector detector = new ServerDetector();
jbossEnv = detector.isJboss();
- }
+ }
@Override
public boolean authenticate(Request request, Response response, LoginConfig
loginConfig) throws IOException
@@ -157,6 +157,10 @@
{
try
{
+ if( saveRestoreRequest )
+ {
+ this.saveRequest(request, session);
+ }
sendRequestToIDP(destination, samlResponseDocument, relayState, response,
willSendRequest);
return false;
@@ -252,6 +256,11 @@
session.setNote(Constants.SESS_USERNAME_NOTE, username);
session.setNote(Constants.SESS_PASSWORD_NOTE, password);
request.setUserPrincipal(principal);
+ //Get the original saved request
+ if( saveRestoreRequest )
+ {
+ this.restoreRequest(request, session);
+ }
register(request, response, principal, Constants.FORM_METHOD, username,
password);
return true;
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 2011-01-27
17:15:07 UTC (rev 674)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java 2011-01-27
17:47:31 UTC (rev 675)
@@ -171,6 +171,11 @@
log.trace("URL used for sending:" + destinationURL);
}
+ if( saveRestoreRequest )
+ {
+ this.saveRequest(request, session);
+ }
+
HTTPRedirectUtil.sendRedirectForRequestor(destinationURL, response);
return false;
}
@@ -289,6 +294,11 @@
session.setNote(Constants.SESS_USERNAME_NOTE, username);
session.setNote(Constants.SESS_PASSWORD_NOTE, password);
request.setUserPrincipal(principal);
+
+ if( saveRestoreRequest )
+ {
+ this.restoreRequest(request, session);
+ }
register(request, response, principal, Constants.FORM_METHOD, username,
password);
return true;
Modified:
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2PostTomcatWorkflowUnitTestCase.java
===================================================================
---
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2PostTomcatWorkflowUnitTestCase.java 2011-01-27
17:15:07 UTC (rev 674)
+++
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2PostTomcatWorkflowUnitTestCase.java 2011-01-27
17:47:31 UTC (rev 675)
@@ -82,7 +82,7 @@
//First we go to the employee application
MockCatalinaContextClassLoader mclSPEmp = setupTCL(profile +
"/sp/employee");
Thread.currentThread().setContextClassLoader(mclSPEmp);
- SPPostFormAuthenticator spEmpl = new SPPostFormAuthenticator();
+ SPPostFormAuthenticator spEmpl = new SPPostFormAuthenticator();
MockCatalinaContext context = new MockCatalinaContext();
spEmpl.setContainer(context);
Modified: federation/trunk/picketlink-fed-api/src/test/resources/log4j.xml
===================================================================
--- federation/trunk/picketlink-fed-api/src/test/resources/log4j.xml 2011-01-27 17:15:07
UTC (rev 674)
+++ federation/trunk/picketlink-fed-api/src/test/resources/log4j.xml 2011-01-27 17:47:31
UTC (rev 675)
@@ -68,6 +68,9 @@
<category name="org.jboss">
<priority value="TRACE"/>
</category>
+ <category name="org.picketlink">
+ <priority value="TRACE"/>
+ </category>
<!-- ======================= -->
<!-- Setup the Root category -->