Author: pcraveiro
Date: 2011-11-15 08:33:01 -0500 (Tue, 15 Nov 2011)
New Revision: 1325
Modified:
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2RedirectSignatureTomcatWorkflowUnitTestCase.java
Log:
Code refactored.
Modified:
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2RedirectSignatureTomcatWorkflowUnitTestCase.java
===================================================================
---
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2RedirectSignatureTomcatWorkflowUnitTestCase.java 2011-11-15
13:23:37 UTC (rev 1324)
+++
federation/trunk/picketlink-bindings/src/test/java/org/picketlink/test/identity/federation/bindings/workflow/SAML2RedirectSignatureTomcatWorkflowUnitTestCase.java 2011-11-15
13:33:01 UTC (rev 1325)
@@ -140,6 +140,56 @@
sendSPRequest(request, true, idpAddress);
}
+ private MockCatalinaResponse sendIDPRequest(MockCatalinaRequest request, boolean
validatingAliasToTokenIssuer)
+ throws LifecycleException, IOException, ServletException
+ {
+ MockCatalinaContextClassLoader mclIDP = setupTCL(IDP_PROFILE);
+ Thread.currentThread().setContextClassLoader(mclIDP);
+
+ IDPWebBrowserSSOValve idp = new IDPWebBrowserSSOValve();
+
+ idp.setSignOutgoingMessages(true);
+ idp.setIgnoreIncomingSignatures(false);
+ idp.setValidatingAliasToTokenIssuer(validatingAliasToTokenIssuer);
+
+ idp.setContainer(request.getContext());
+ idp.start();
+
+ MockCatalinaResponse response = new MockCatalinaResponse();
+
+ idp.invoke(request, response);
+
+ return response;
+ }
+
+ private MockCatalinaResponse sendSPRequest(MockCatalinaRequest request, boolean
validateAuthentication, String idpAddress)
+ throws LifecycleException, IOException
+ {
+ MockCatalinaContextClassLoader mclSPEmp = setupTCL(SP_PROFILE);
+ Thread.currentThread().setContextClassLoader(mclSPEmp);
+
+ SPRedirectSignatureFormAuthenticator sp = new
SPRedirectSignatureFormAuthenticator();
+
+ sp.setIdpAddress(idpAddress);
+
+ request.setParameter(GeneralConstants.RELAY_STATE, null);
+
+ MockCatalinaLoginConfig loginConfig = new MockCatalinaLoginConfig();
+
+ sp.setContainer(request.getContext());
+ sp.testStart();
+
+ MockCatalinaResponse response = new MockCatalinaResponse();
+
+ if (validateAuthentication) {
+ Assert.assertTrue("Employee app succesfully authenticated.",
sp.authenticate(request, response, loginConfig));
+ } else {
+ sp.authenticate(request, response, loginConfig);
+ }
+
+ return response;
+ }
+
private MockCatalinaRequest createRequest(String userAddress)
{
MockCatalinaRequest request = new MockCatalinaRequest();
@@ -195,56 +245,6 @@
}
});
}
-
- private MockCatalinaResponse sendIDPRequest(MockCatalinaRequest request, boolean
validatingAliasToTokenIssuer)
- throws LifecycleException, IOException, ServletException
- {
- MockCatalinaContextClassLoader mclIDP = setupTCL(IDP_PROFILE);
- Thread.currentThread().setContextClassLoader(mclIDP);
-
- IDPWebBrowserSSOValve idp = new IDPWebBrowserSSOValve();
-
- idp.setSignOutgoingMessages(true);
- idp.setIgnoreIncomingSignatures(false);
- idp.setValidatingAliasToTokenIssuer(validatingAliasToTokenIssuer);
-
- idp.setContainer(request.getContext());
- idp.start();
-
- MockCatalinaResponse response = new MockCatalinaResponse();
-
- idp.invoke(request, response);
-
- return response;
- }
-
- private MockCatalinaResponse sendSPRequest(MockCatalinaRequest request, boolean
validateAuthentication, String idpAddress)
- throws LifecycleException, IOException
- {
- MockCatalinaContextClassLoader mclSPEmp = setupTCL(SP_PROFILE);
- Thread.currentThread().setContextClassLoader(mclSPEmp);
-
- SPRedirectSignatureFormAuthenticator sp = new
SPRedirectSignatureFormAuthenticator();
-
- sp.setIdpAddress(idpAddress);
-
- request.setParameter(GeneralConstants.RELAY_STATE, null);
-
- MockCatalinaLoginConfig loginConfig = new MockCatalinaLoginConfig();
-
- sp.setContainer(request.getContext());
- sp.testStart();
-
- MockCatalinaResponse response = new MockCatalinaResponse();
-
- if (validateAuthentication) {
- Assert.assertTrue("Employee app succesfully authenticated.",
sp.authenticate(request, response, loginConfig));
- } else {
- sp.authenticate(request, response, loginConfig);
- }
-
- return response;
- }
private MockCatalinaContextClassLoader setupTCL(String resource)
{
Show replies by date