spEmpl.setContainer(context);
spEmpl.testStart();
MockCatalinaRequest catalinaRequest = new MockCatalinaRequest();
MockCatalinaResponse catalinaResponse = new MockCatalinaResponse();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
catalinaResponse.setOutputStream(baos);
LoginConfig loginConfig = new LoginConfig();
spEmpl.authenticate(catalinaRequest, catalinaResponse, loginConfig);
String spResponse = new String(baos.toByteArray());
Document spHTMLResponse = DocumentUtil.getDocument(spResponse);
NodeList nodes = spHTMLResponse.getElementsByTagName("INPUT");
Element inputElement = (Element) nodes.item(0);
String idpResponse = inputElement.getAttributeNode("VALUE").getValue();
@SuppressWarnings("unused")
String relayState = null;
if (nodes.getLength() > 1)
relayState = ((Element) nodes.item(1)).getAttributeNode("VALUE").getValue();
// Lets call the IDPServlet
MockCatalinaSession session = new MockCatalinaSession();
servletContext = new MockCatalinaContext();
session.setServletContext(servletContext);
IdentityServer server = this.getIdentityServer(session);
servletContext.setAttribute("IDENTITY_SERVER", server);
MockCatalinaContextClassLoader mclIDP = setupTCL(profile + "/idp");
Thread.currentThread().setContextClassLoader(mclIDP);
MockCatalinaRequest request = new MockCatalinaRequest();
request.addHeader("Referer", "http://localhost:8080/employee/");
request.setParameter(GeneralConstants.USERNAME_FIELD, "anil");
request.setParameter(GeneralConstants.PASS_FIELD, "anil");
MockCatalinaResponse response = new MockCatalinaResponse();
baos = new ByteArrayOutputStream();
response.setOutputStream(baos);
context = new MockCatalinaContext();
IDPWebBrowserSSOValve idp = new IDPWebBrowserSSOValve();
idp.setContainer(context);
idp.setSignOutgoingMessages(false);