+ " user account."), request, response, configurationReader.getErrorUrl());
return;
}
log.info("1.a. Starting transaction");
OA4MPResponse gtwResp;
Map<String, String> queryParameters = new HashMap<String, String>();
queryParameters.put(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER, gatewayName);
queryParameters.put(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER, portalUserName);
queryParameters.put(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER, contactEmail);
queryParameters.put(CredentialStoreConstants.PORTAL_TOKEN_ID_ASSIGNED, associatedToken);
Map<String, String> additionalParameters = new HashMap<String, String>();
String modifiedCallbackUri = decorateURI(getOA4MPService().getEnvironment().getCallback(), queryParameters);
info("The modified callback URI - " + modifiedCallbackUri);
additionalParameters.put(getEnvironment().getConstants().get(CALLBACK_URI_KEY), modifiedCallbackUri);
try {
gtwResp = getOA4MPService().requestCert(additionalParameters);
// Private key in store
PrivateKeyStore privateKeyStore = PrivateKeyStore.getPrivateKeyStore();
privateKeyStore.addKey(associatedToken, gtwResp.getPrivateKey());
} catch (Throwable t) {
JSPUtil.handleException(t, request, response, configurationReader.getErrorUrl());
return;
}
log.info("1.b. Got response. Creating page with redirect for " + gtwResp.getRedirect().getHost());
// Normally, we'd just do a redirect, but we will put up a page and show the redirect to the user.
// The client response contains the generated private key as well
// In a real application, the private key would be stored. This, however, exceeds the scope of this
// sample application -- all we need to do to complete the process is send along the redirect url.
request.setAttribute(REDIR, REDIR);
request.setAttribute("redirectUrl", gtwResp.getRedirect().toString());
request.setAttribute(ACTION_KEY, ACTION_KEY);
request.setAttribute("action", ACTION_REDIRECT_VALUE);
log.info("1.b. Showing redirect page.");
JSPUtil.fwd(request, response, configurationReader.getPortalRedirectUrl());