/** * Handles termination return message. * * @param request <code>HttpServletRequest</code> object that contains the request the client has * made of the servlet. * @param response <code>HttpServletResponse</code> object that contains the response the servlet * sends to the client. * @exception ServletException if an input or output error is detected when the servlet handles * the request * @exception IOException if the request could not be handled */ private void doGetPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { FSUtils.debug.message("FSTerminationReturnServlet doGetPost..."); String providerAlias = FSServiceUtils.getMetaAlias(request); if (providerAlias == null || providerAlias.length() < 1) { if (FSUtils.debug.messageEnabled()) { FSUtils.debug.message( "Unable to retrieve alias, Hosted" + " Provider. Cannot process request"); } response.sendError( response.SC_INTERNAL_SERVER_ERROR, FSUtils.bundle.getString("aliasNotFound")); return; } StringBuffer terminationDone = new StringBuffer(); BaseConfigType hostedConfig = null; try { String hostedRole = metaManager.getProviderRoleByMetaAlias(providerAlias); String hostedEntityId = metaManager.getEntityIDByMetaAlias(providerAlias); String realm = IDFFMetaUtils.getRealmByMetaAlias(providerAlias); if (hostedRole != null && hostedRole.equalsIgnoreCase(IFSConstants.IDP)) { hostedConfig = metaManager.getIDPDescriptorConfig(realm, hostedEntityId); } else if (hostedRole != null && hostedRole.equalsIgnoreCase(IFSConstants.SP)) { hostedConfig = metaManager.getSPDescriptorConfig(realm, hostedEntityId); } if (hostedRole == null || hostedConfig == null) { throw new IDFFMetaException((String) null); } } catch (IDFFMetaException e) { FSUtils.debug.error("Failed to get Hosted Provider"); response.sendError( response.SC_INTERNAL_SERVER_ERROR, FSUtils.bundle.getString(IFSConstants.FAILED_HOSTED_DESCRIPTOR)); return; } terminationDone.append( FSServiceUtils.getTerminationDonePageURL(request, hostedConfig, providerAlias)); if (FSUtils.debug.messageEnabled()) { FSUtils.debug.message("Final Done page URL at local end: " + terminationDone.toString()); } response.sendRedirect(terminationDone.toString()); return; }
/** Invoked to set some commonly used URLs based on hosted provider. */ protected void setTerminationURL() { termination_done_url = FSServiceUtils.getTerminationDonePageURL(request, hostedConfig, metaAlias); error_page_url = FSServiceUtils.getErrorPageURL(request, hostedConfig, metaAlias); }