String httpMethod = isPostBinding ? "POST" : "GET";
MockHttpServletRequest servletRequest = new MockHttpServletRequest(session, httpMethod);
MockHttpServletResponse servletResponse = new MockHttpServletResponse();
HTTPContext httpContext = new HTTPContext(servletRequest, servletResponse, servletContext);
SAMLDocumentHolder docHolder = new SAMLDocumentHolder(authnRequest, authDoc);
IssuerInfoHolder issuerInfo = new IssuerInfoHolder("http://localhost:8080/idp/");
SAML2HandlerRequest request = new DefaultSAML2HandlerRequest(httpContext, issuerInfo.getIssuer(), docHolder,
SAML2Handler.HANDLER_TYPE.IDP);
request.setTypeOfRequestToBeGenerated(GENERATE_REQUEST_TYPE.AUTH);
SAML2HandlerResponse response = new DefaultSAML2HandlerResponse();
response.setPostBindingForResponse(isPostBinding);
request.addOption(GeneralConstants.SENDER_PUBLIC_KEY, keypair.getPublic());
SAML2AuthenticationHandler authHandler = new SAML2AuthenticationHandler();
authHandler.initChainConfig(chainConfig);
authHandler.initHandlerConfig(handlerConfig);
authHandler.generateSAMLRequest(request, response);
handler.generateSAMLRequest(request, response);
Document signedDoc = response.getResultingDocument();
assertNotNull("Signed Doc is not null", signedDoc);
SAMLDocumentHolder signedHolder = new SAMLDocumentHolder(signedDoc);
request = new DefaultSAML2HandlerRequest(httpContext, issuerInfo.getIssuer(), signedHolder,
SAML2Handler.HANDLER_TYPE.SP);
request.addOption(GeneralConstants.SENDER_PUBLIC_KEY, keypair.getPublic());