Search in sources :

Example 36 with FSMsgException

use of com.sun.identity.federation.message.common.FSMsgException in project OpenAM by OpenRock.

the class FSNameIdentifierMappingResponse method parseXML.

/**
     * Creates <code>FSNameIdentifierMappingResponse</code> object.
     * This object is created by parsing the <code>XML</code> string.
     *
     * @param xml the <code>XML</code> string to be parse.
     * @return the <code>FSNameIdentifierMappingResponse</code> object.
     * @throws FSMsgException if there is an error in parsing the
     *            <code>XML</code> string.
     */
public static FSNameIdentifierMappingResponse parseXML(String xml) throws FSMsgException {
    Document doc = XMLUtils.toDOMDocument(xml, FSUtils.debug);
    if (doc == null) {
        FSUtils.debug.error("FSNameIdentifierMappingResponse.parseXML: " + "error while parsing input xml string");
        throw new FSMsgException("parseError", null);
    }
    Element root = doc.getDocumentElement();
    return new FSNameIdentifierMappingResponse(root);
}
Also used : FSMsgException(com.sun.identity.federation.message.common.FSMsgException) Element(org.w3c.dom.Element) Document(org.w3c.dom.Document)

Example 37 with FSMsgException

use of com.sun.identity.federation.message.common.FSMsgException in project OpenAM by OpenRock.

the class FSAssertionManagerImpl method getErrorStatus.

public String getErrorStatus(String metaAlias, String artifact) throws FSRemoteException {
    try {
        if (FSUtils.debug.messageEnabled()) {
            FSUtils.debug.message("FSAssertionManagerImpl.getErrStatus(" + metaAlias + ", " + artifact);
        }
        AssertionArtifact aa = new FSAssertionArtifact(artifact);
        Status s = FSAssertionManager.getInstance(metaAlias).getErrorStatus(aa);
        if (null != s)
            return s.toString(true, true);
    } catch (FSMsgException e) {
        FSUtils.debug.error("getErrStatus: FSMsgException:" + e.getMessage());
        throw new FSRemoteException(e.getMessage());
    } catch (FSException e) {
        FSUtils.debug.error("getErrStatus: FSException:" + e.getMessage());
        throw new FSRemoteException(e.getMessage());
    }
    if (FSUtils.debug.messageEnabled()) {
        FSUtils.debug.message("getErrStatus: returning null");
    }
    return null;
}
Also used : Status(com.sun.identity.saml.protocol.Status) FSMsgException(com.sun.identity.federation.message.common.FSMsgException) FSException(com.sun.identity.federation.common.FSException) FSAssertionArtifact(com.sun.identity.federation.message.FSAssertionArtifact) FSAssertionArtifact(com.sun.identity.federation.message.FSAssertionArtifact) AssertionArtifact(com.sun.identity.saml.protocol.AssertionArtifact) FSRemoteException(com.sun.identity.federation.common.FSRemoteException)

Example 38 with FSMsgException

use of com.sun.identity.federation.message.common.FSMsgException in project OpenAM by OpenRock.

the class FSRegistrationReturnServlet method doGetPost.

/**
     * Handles the request.
     * @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("FSRegistrationReturnServlet doGetPost...");
    String providerAlias = "";
    providerAlias = FSServiceUtils.getMetaAlias(request);
    if (providerAlias == null || providerAlias.length() < 1) {
        FSUtils.debug.error("Unable to retrieve alias, Hosted" + " Provider. Cannot process request");
        response.sendError(response.SC_INTERNAL_SERVER_ERROR, FSUtils.bundle.getString("aliasNotFound"));
        return;
    }
    if (metaManager == null) {
        FSUtils.debug.error("Cannot retrieve hosted descriptor. " + "Cannot process request");
        response.sendError(response.SC_INTERNAL_SERVER_ERROR, FSUtils.bundle.getString(IFSConstants.FAILED_HOSTED_DESCRIPTOR));
        return;
    }
    String realm = IDFFMetaUtils.getRealmByMetaAlias(providerAlias);
    ProviderDescriptorType hostedProviderDesc = null;
    BaseConfigType hostedConfig = null;
    String hostedEntityId = null;
    String hostedProviderRole = null;
    try {
        hostedProviderRole = metaManager.getProviderRoleByMetaAlias(providerAlias);
        hostedEntityId = metaManager.getEntityIDByMetaAlias(providerAlias);
        if (hostedProviderRole != null && hostedProviderRole.equalsIgnoreCase(IFSConstants.IDP)) {
            hostedProviderDesc = metaManager.getIDPDescriptor(realm, hostedEntityId);
            hostedConfig = metaManager.getIDPDescriptorConfig(realm, hostedEntityId);
        } else if (hostedProviderRole != null && hostedProviderRole.equalsIgnoreCase(IFSConstants.SP)) {
            hostedProviderDesc = metaManager.getSPDescriptor(realm, hostedEntityId);
            hostedConfig = metaManager.getSPDescriptorConfig(realm, hostedEntityId);
        }
        if (hostedProviderDesc == null) {
            throw new IDFFMetaException((String) null);
        }
    } catch (IDFFMetaException eam) {
        FSUtils.debug.error("Unable to find Hosted Provider. not process request");
        response.sendError(response.SC_INTERNAL_SERVER_ERROR, FSUtils.bundle.getString(IFSConstants.FAILED_HOSTED_DESCRIPTOR));
        return;
    }
    this.request = request;
    setRegistrationURL(hostedConfig, providerAlias);
    // Here we will need to
    //        1. verify response signature
    //        2. verify response status
    //        3. retrieve registration request Id from Map
    //        4. if status success then do locally else not do locally and
    //        5. show status page or LRURL if found in MAP
    //           (eg intersiteTransfer)
    FSNameRegistrationResponse regisResponse = null;
    try {
        regisResponse = FSNameRegistrationResponse.parseURLEncodedRequest(request);
    } catch (FSMsgException e) {
        FSServiceUtils.showErrorPage(response, COMMON_ERROR_PAGE, IFSConstants.REGISTRATION_REQUEST_IMPROPER, IFSConstants.REGISTRATION_FAILED);
        return;
    } catch (SAMLException e) {
        FSServiceUtils.showErrorPage(response, COMMON_ERROR_PAGE, IFSConstants.REGISTRATION_REQUEST_IMPROPER, IFSConstants.REGISTRATION_FAILED);
        return;
    }
    String remoteEntityId = regisResponse.getProviderId();
    ProviderDescriptorType remoteDesc = null;
    boolean isIDP = false;
    try {
        if (hostedProviderRole.equalsIgnoreCase(IFSConstants.SP)) {
            remoteDesc = metaManager.getIDPDescriptor(realm, remoteEntityId);
            isIDP = true;
        } else {
            remoteDesc = metaManager.getSPDescriptor(realm, remoteEntityId);
        }
    } catch (IDFFMetaException e) {
        FSUtils.debug.error("FSRegistrationReturnServlet:", e);
    }
    if (remoteDesc == null) {
        FSServiceUtils.showErrorPage(response, COMMON_ERROR_PAGE, IFSConstants.REGISTRATION_REQUEST_IMPROPER, IFSConstants.REGISTRATION_FAILED);
        return;
    }
    boolean bVerify = true;
    try {
        if (FSServiceUtils.isSigningOn()) {
            bVerify = verifyResponseSignature(request, remoteDesc, remoteEntityId, isIDP);
        }
    } catch (SAMLException e) {
        bVerify = false;
    } catch (FSException e) {
        bVerify = false;
    }
    if (bVerify) {
        FSNameRegistrationHandler handlerObj = new FSNameRegistrationHandler();
        handlerObj.setHostedDescriptor(hostedProviderDesc);
        handlerObj.setHostedDescriptorConfig(hostedConfig);
        handlerObj.setHostedEntityId(hostedEntityId);
        handlerObj.setHostedProviderRole(hostedProviderRole);
        handlerObj.setMetaAlias(providerAlias);
        handlerObj.setRemoteEntityId(remoteEntityId);
        handlerObj.setRemoteDescriptor(remoteDesc);
        handlerObj.setRealm(realm);
        handlerObj.processRegistrationResponse(request, response, regisResponse);
        return;
    } else {
        FSUtils.debug.error("FSRegistrationReturnServlet " + "Signature on registration request is invalid" + "Cannot proceed name registration");
        String[] data = { FSUtils.bundle.getString(IFSConstants.REGISTRATION_INVALID_SIGNATURE) };
        LogUtil.error(Level.INFO, LogUtil.INVALID_SIGNATURE, data);
        FSServiceUtils.showErrorPage(response, COMMON_ERROR_PAGE, IFSConstants.REGISTRATION_REQUEST_IMPROPER, IFSConstants.REGISTRATION_FAILED);
        return;
    }
}
Also used : BaseConfigType(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType) FSMsgException(com.sun.identity.federation.message.common.FSMsgException) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) ProviderDescriptorType(com.sun.identity.liberty.ws.meta.jaxb.ProviderDescriptorType) FSNameRegistrationResponse(com.sun.identity.federation.message.FSNameRegistrationResponse) FSException(com.sun.identity.federation.common.FSException) SAMLException(com.sun.identity.saml.common.SAMLException)

Example 39 with FSMsgException

use of com.sun.identity.federation.message.common.FSMsgException in project OpenAM by OpenRock.

the class FSFedTerminationHandler method doFederationTermination.

/**
     * Initiates federation termination at remote end.
     * The termination requested is constructed and based on the profile the
     * request is sent over SOAP or as HTTP redirect. Profile is always based on
     * the SPs profile
     * @param acctInfo represents the user account federation information
     * @return <code>true</code> if termination request is sent to remote
     *  provider successfully; <code>false</code> otherwise.
     */
private boolean doFederationTermination(HttpServletRequest request, HttpServletResponse response, FSAccountFedInfo acctInfo) {
    FSUtils.debug.message("Entered FSFedTerminationHandler::doFederationTermination");
    try {
        if (FSUtils.debug.messageEnabled()) {
            FSUtils.debug.message("FSFedTerminationHandler::doFederationTermination create" + " request start");
        }
        FSFederationTerminationNotification reqFedTermination = createFederationTerminationRequest(acctInfo);
        reqFedTermination.setMinorVersion(FSServiceUtils.getMinorVersion(remoteDescriptor.getProtocolSupportEnumeration()));
        if (reqFedTermination == null) {
            if (FSUtils.debug.messageEnabled()) {
                FSUtils.debug.message("FSIDPFedTerminationHandler::Termination request could " + "not be formed");
            }
            // Always show success page since local termination succeeded
            FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
            return false;
        }
        if (FSUtils.debug.messageEnabled()) {
            FSUtils.debug.message("FSIDPFedTerminationHandler::Termination request formed" + "successfully");
        }
        // Find out which profile to use
        boolean isSOAPProfile = true;
        if (acctInfo.isRoleIDP()) {
            List hostProfiles = hostedDescriptor.getFederationTerminationNotificationProtocolProfile();
            if (hostProfiles == null || hostProfiles.isEmpty()) {
                FSUtils.debug.error("FSFedTerminationHandler::" + "doFederationTermination no termination profile" + " cannot process request");
                FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
                return false;
            }
            String profile = (String) hostProfiles.iterator().next();
            if (profile.equalsIgnoreCase(IFSConstants.TERMINATION_SP_SOAP_PROFILE) || profile.equalsIgnoreCase(IFSConstants.TERMINATION_IDP_SOAP_PROFILE)) {
                isSOAPProfile = true;
            } else if (profile.equalsIgnoreCase(IFSConstants.TERMINATION_SP_HTTP_PROFILE) || profile.equalsIgnoreCase(IFSConstants.TERMINATION_IDP_HTTP_PROFILE)) {
                isSOAPProfile = false;
            } else {
                FSUtils.debug.error("FSFedTerminationHandler::" + "doFederationTermination Invalid termination profile" + " cannot process request");
                FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
                return false;
            }
        } else {
            List remoteProfiles = remoteDescriptor.getFederationTerminationNotificationProtocolProfile();
            if (remoteProfiles == null || remoteProfiles.isEmpty()) {
                FSUtils.debug.error("FSFedTerminationHandler::" + "doFederationTermination no termination profile" + " cannot process request");
                FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
                return false;
            }
            String profile = (String) remoteProfiles.iterator().next();
            if (profile.equalsIgnoreCase(IFSConstants.TERMINATION_SP_SOAP_PROFILE) || profile.equalsIgnoreCase(IFSConstants.TERMINATION_IDP_SOAP_PROFILE)) {
                isSOAPProfile = true;
            } else if (profile.equalsIgnoreCase(IFSConstants.TERMINATION_SP_HTTP_PROFILE) || profile.equalsIgnoreCase(IFSConstants.TERMINATION_IDP_HTTP_PROFILE)) {
                isSOAPProfile = false;
            } else {
                FSUtils.debug.error("FSFedTerminationHandler::" + "doFederationTermination Invalid termination profile" + " cannot process request");
                FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
                return false;
            }
        }
        if (isSOAPProfile) {
            FSSOAPService instSOAP = FSSOAPService.getInstance();
            if (instSOAP != null) {
                FSUtils.debug.message("Signing suceeded. To call bindTerminationRequest");
                //String id = reqFedTermination.getRequestID();
                reqFedTermination.setID(IFSConstants.TERMINATIONID);
                SOAPMessage msgTermination = instSOAP.bind(reqFedTermination.toXMLString(true, true));
                if (msgTermination != null) {
                    try {
                        if (FSServiceUtils.isSigningOn()) {
                            int minorVersion = reqFedTermination.getMinorVersion();
                            if (minorVersion == IFSConstants.FF_11_PROTOCOL_MINOR_VERSION) {
                                msgTermination = signTerminationRequest(msgTermination, IFSConstants.ID, reqFedTermination.getID());
                            } else if (minorVersion == IFSConstants.FF_12_PROTOCOL_MINOR_VERSION) {
                                msgTermination = signTerminationRequest(msgTermination, IFSConstants.REQUEST_ID, reqFedTermination.getRequestID());
                            } else {
                                FSUtils.debug.message("invalid minor version.");
                            }
                        }
                        boolean sendStatus = instSOAP.sendTerminationMessage(msgTermination, remoteDescriptor.getSoapEndpoint());
                        // Call SP Adapter for SP initiated SOAP profile
                        if (hostedProviderRole != null && hostedProviderRole.equalsIgnoreCase(IFSConstants.SP)) {
                            FederationSPAdapter spAdapter = FSServiceUtils.getSPAdapter(hostedEntityId, hostedConfig);
                            if (spAdapter != null) {
                                try {
                                    spAdapter.postTerminationNotificationSuccess(hostedEntityId, request, response, userID, reqFedTermination, IFSConstants.TERMINATION_SP_SOAP_PROFILE);
                                } catch (Exception e) {
                                    // ignore adapter exception
                                    FSUtils.debug.error("postTerm.SP/SOAP", e);
                                }
                            }
                        }
                        // Always show success page since local termination
                        // succeeded and that is what is important
                        FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
                        return sendStatus;
                    } catch (Exception e) {
                        FSUtils.debug.error("FSFedTerminationHandler::" + "doFederationTermination " + FSUtils.bundle.getString(IFSConstants.TERMINATION_FAILED_SEND_REMOTE));
                        // Always show success page since local
                        // termination succeeded
                        FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
                        return false;
                    }
                } else {
                    if (FSUtils.debug.messageEnabled()) {
                        FSUtils.debug.message("FSSPFedTerminationHandler::doFederation" + "Termination failed. Error in forming Message");
                    }
                    FSUtils.debug.error("FSSPFedTerminationHandler.doFederationTermination " + FSUtils.bundle.getString(IFSConstants.TERMINATION_FAILED_SEND_REMOTE));
                    // Always show success page since local termination
                    // succeeded
                    FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
                    return false;
                }
            }
            if (FSUtils.debug.messageEnabled()) {
                FSUtils.debug.message("FSFedTerminationHandler::doFederationTermination " + "failed. Cannot get Service Manager instance");
            }
            FSUtils.debug.error("FSSPFedTerminationHandler::doFederationTermination " + FSUtils.bundle.getString(IFSConstants.TERMINATION_FAILED_SEND_REMOTE));
            // Always show success page since local termination succeeded
            FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
            return false;
        } else {
            if (FSUtils.debug.messageEnabled()) {
                FSUtils.debug.message("FSFedTerminationHandler::doFederationTermination " + "In Redirect profile");
            }
            String urlEncodedRequest = reqFedTermination.toURLEncodedQueryString();
            // Sign the request querystring
            if (FSServiceUtils.isSigningOn()) {
                String certAlias = IDFFMetaUtils.getFirstAttributeValueFromConfig(hostedConfig, IFSConstants.SIGNING_CERT_ALIAS);
                if (certAlias == null || certAlias.length() == 0) {
                    if (FSUtils.debug.messageEnabled()) {
                        FSUtils.debug.message("FSBrowserArtifactConsumerHandler:: " + "signSAMLRequest:" + "couldn't obtain this site's cert alias.");
                    }
                    throw new SAMLResponderException(FSUtils.bundle.getString(IFSConstants.NO_CERT_ALIAS));
                }
                urlEncodedRequest = FSSignatureUtil.signAndReturnQueryString(urlEncodedRequest, certAlias);
            }
            StringBuffer redirectURL = new StringBuffer();
            if (FSUtils.debug.messageEnabled()) {
                FSUtils.debug.message("Request to be sent : " + urlEncodedRequest);
            }
            String retURL = remoteDescriptor.getFederationTerminationServiceURL();
            redirectURL.append(retURL);
            if (retURL.indexOf(IFSConstants.QUESTION_MARK) == -1) {
                redirectURL.append(IFSConstants.QUESTION_MARK);
            } else {
                redirectURL.append(IFSConstants.AMPERSAND);
            }
            redirectURL.append(urlEncodedRequest);
            if (FSUtils.debug.messageEnabled()) {
                FSUtils.debug.message("FSFedTerminationHandler::Redirect URL is " + redirectURL.toString());
            }
            // FSTerminationReturnServlet, but info not available there
            if (hostedProviderRole != null && hostedProviderRole.equalsIgnoreCase(IFSConstants.SP)) {
                FederationSPAdapter spAdapter = FSServiceUtils.getSPAdapter(hostedEntityId, hostedConfig);
                if (spAdapter != null) {
                    try {
                        spAdapter.postTerminationNotificationSuccess(hostedEntityId, request, response, userID, reqFedTermination, IFSConstants.TERMINATION_SP_HTTP_PROFILE);
                    } catch (Exception e) {
                        // ignore adapter exception
                        FSUtils.debug.error("postTerm.SP/HTTP", e);
                    }
                }
            }
            response.sendRedirect(redirectURL.toString());
            return true;
        }
    } catch (IOException e) {
        FSUtils.debug.error("FSFedTerminationHandler" + FSUtils.bundle.getString(IFSConstants.FEDERATION_REDIRECT_FAILED));
    } catch (FSMsgException e) {
        FSUtils.debug.error("FSFedTerminationHandler::doFederationTermination " + FSUtils.bundle.getString(IFSConstants.TERMINATION_FAILED_SEND_REMOTE));
    } catch (SAMLResponderException e) {
        FSUtils.debug.error("FSFedTerminationHandler::doFederationTermination " + FSUtils.bundle.getString(IFSConstants.TERMINATION_FAILED_SEND_REMOTE));
    }
    // Always show success page since local termination succeeded
    FSServiceUtils.returnLocallyAfterOperation(response, termination_done_url, true, IFSConstants.TERMINATION_SUCCESS, IFSConstants.TERMINATION_FAILURE);
    return false;
}
Also used : FSMsgException(com.sun.identity.federation.message.common.FSMsgException) FSFederationTerminationNotification(com.sun.identity.federation.message.FSFederationTerminationNotification) FSSOAPService(com.sun.identity.federation.services.FSSOAPService) IOException(java.io.IOException) SOAPMessage(javax.xml.soap.SOAPMessage) SAMLResponderException(com.sun.identity.saml.common.SAMLResponderException) SessionException(com.sun.identity.plugin.session.SessionException) SAMLException(com.sun.identity.saml.common.SAMLException) IOException(java.io.IOException) FSAccountMgmtException(com.sun.identity.federation.accountmgmt.FSAccountMgmtException) FSMsgException(com.sun.identity.federation.message.common.FSMsgException) List(java.util.List) FederationSPAdapter(com.sun.identity.federation.plugins.FederationSPAdapter) SAMLResponderException(com.sun.identity.saml.common.SAMLResponderException)

Example 40 with FSMsgException

use of com.sun.identity.federation.message.common.FSMsgException in project OpenAM by OpenRock.

the class FSRegistrationRequestServlet method doGetPost.

/**
     * Handles registration request.
     * in the application
     * @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 IOException if the request could not be handled
     */
private void doGetPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // Alias processing        
    String providerAlias = FSServiceUtils.getMetaAlias(request);
    if (providerAlias == null || providerAlias.length() < 1) {
        FSUtils.debug.error("Unable to retrieve alias, Hosted " + "Provider. Cannot process request");
        response.sendError(response.SC_INTERNAL_SERVER_ERROR, FSUtils.bundle.getString("aliasNotFound"));
        return;
    }
    if (metaManager == null) {
        FSUtils.debug.error("Cannot retrieve hosted descriptor. " + "Cannot process request");
        response.sendError(response.SC_INTERNAL_SERVER_ERROR, FSUtils.bundle.getString(IFSConstants.FAILED_HOSTED_DESCRIPTOR));
        return;
    }
    String realm = IDFFMetaUtils.getRealmByMetaAlias(providerAlias);
    ProviderDescriptorType hostedProviderDesc = null;
    BaseConfigType hostedConfig = null;
    String hostedEntityId = null;
    String hostedProviderRole = null;
    try {
        hostedProviderRole = metaManager.getProviderRoleByMetaAlias(providerAlias);
        hostedEntityId = metaManager.getEntityIDByMetaAlias(providerAlias);
        if (hostedProviderRole != null && hostedProviderRole.equalsIgnoreCase(IFSConstants.IDP)) {
            hostedProviderDesc = metaManager.getIDPDescriptor(realm, hostedEntityId);
            hostedConfig = metaManager.getIDPDescriptorConfig(realm, hostedEntityId);
        } else if (hostedProviderRole != null && hostedProviderRole.equalsIgnoreCase(IFSConstants.SP)) {
            hostedProviderDesc = metaManager.getSPDescriptor(realm, hostedEntityId);
            hostedConfig = metaManager.getSPDescriptorConfig(realm, hostedEntityId);
        }
        if (hostedProviderDesc == null) {
            throw new IDFFMetaException((String) null);
        }
    } catch (IDFFMetaException eam) {
        FSUtils.debug.error("Unable to find Hosted Provider. not process request");
        response.sendError(response.SC_INTERNAL_SERVER_ERROR, FSUtils.bundle.getString(IFSConstants.FAILED_HOSTED_DESCRIPTOR));
        return;
    }
    this.request = request;
    setRegistrationURL(hostedConfig, providerAlias);
    FSNameRegistrationRequest regisRequest = new FSNameRegistrationRequest();
    try {
        regisRequest = FSNameRegistrationRequest.parseURLEncodedRequest(request);
    } catch (FSMsgException e) {
        FSServiceUtils.showErrorPage(response, COMMON_ERROR_PAGE, IFSConstants.REGISTRATION_REQUEST_IMPROPER, IFSConstants.REGISTRATION_FAILED);
        return;
    } catch (SAMLException e) {
        FSServiceUtils.showErrorPage(response, COMMON_ERROR_PAGE, IFSConstants.REGISTRATION_REQUEST_IMPROPER, IFSConstants.REGISTRATION_FAILED);
        return;
    }
    if (regisRequest == null) {
        FSServiceUtils.showErrorPage(response, COMMON_ERROR_PAGE, IFSConstants.REGISTRATION_REQUEST_IMPROPER, IFSConstants.REGISTRATION_FAILED);
    } else {
        doRequestProcessing(request, response, hostedProviderDesc, hostedConfig, hostedProviderRole, realm, hostedEntityId, providerAlias, regisRequest);
    }
}
Also used : BaseConfigType(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType) FSMsgException(com.sun.identity.federation.message.common.FSMsgException) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) ProviderDescriptorType(com.sun.identity.liberty.ws.meta.jaxb.ProviderDescriptorType) FSNameRegistrationRequest(com.sun.identity.federation.message.FSNameRegistrationRequest) SAMLException(com.sun.identity.saml.common.SAMLException)

Aggregations

FSMsgException (com.sun.identity.federation.message.common.FSMsgException)46 SAMLException (com.sun.identity.saml.common.SAMLException)17 Document (org.w3c.dom.Document)15 Element (org.w3c.dom.Element)15 BaseConfigType (com.sun.identity.federation.jaxb.entityconfig.BaseConfigType)10 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)10 ProviderDescriptorType (com.sun.identity.liberty.ws.meta.jaxb.ProviderDescriptorType)8 Status (com.sun.identity.saml.protocol.Status)8 IOException (java.io.IOException)8 Iterator (java.util.Iterator)8 FSException (com.sun.identity.federation.common.FSException)7 ParseException (java.text.ParseException)7 SessionException (com.sun.identity.plugin.session.SessionException)6 FSNameRegistrationResponse (com.sun.identity.federation.message.FSNameRegistrationResponse)5 StatusCode (com.sun.identity.saml.protocol.StatusCode)5 FSLogoutNotification (com.sun.identity.federation.message.FSLogoutNotification)4 NameIdentifier (com.sun.identity.saml.assertion.NameIdentifier)4 List (java.util.List)4 SOAPMessage (javax.xml.soap.SOAPMessage)4 FSAccountMgmtException (com.sun.identity.federation.accountmgmt.FSAccountMgmtException)3