SimpleSAML_Utilities::fatalError PHP Method

fatalError() public static method

Deprecation: This method will be removed in SSP 2.0. Please raise a SimpleSAML_Error_Error exception instead.
public static fatalError ( $trackId = 'na', $errorCode = null, Exception $e = null )
$e Exception
    public static function fatalError($trackId = 'na', $errorCode = null, Exception $e = null)
    {
        throw new SimpleSAML_Error_Error($errorCode, $e);
    }

Usage Example

Ejemplo n.º 1
0
/**
 * Helper function for handling exception/errors.
 *
 * This function will send an error response to the SP which contacted this IdP.
 *
 * @param Exception $exception  The exception.
 */
function handleError(Exception $exception)
{
    global $requestcache, $config, $metadata, $idpentityid;
    assert('is_array($requestcache)');
    assert('array_key_exists("Issuer", $requestcache)');
    $issuer = $requestcache['Issuer'];
    if (array_key_exists('RequestID', $requestcache)) {
        $requestID = $requestcache['RequestID'];
    } else {
        $requestID = NULL;
    }
    if (array_key_exists('RelayState', $requestcache)) {
        $relayState = $requestcache['RelayState'];
    } else {
        $relayState = NULL;
    }
    $error = sspmod_saml2_Error::fromException($exception);
    SimpleSAML_Logger::warning('Returning error to sp: ' . var_export($issuer, TRUE));
    $error->logWarning();
    try {
        $idpMetadata = $metadata->getMetaDataConfig($idpentityid, 'saml20-idp-hosted');
        $spMetadata = $metadata->getMetaDataConfig($issuer, 'saml20-sp-remote');
        if (array_key_exists('ConsumerURL', $requestcache)) {
            $consumerURL = $requestcache['ConsumerURL'];
        } else {
            $urlArray = $spMetadata->getArrayizeString('AssertionConsumerService');
            $consumerURL = $urlArray[0];
        }
        $ar = sspmod_saml2_Message::buildResponse($idpMetadata, $spMetadata, $consumerURL);
        $ar->setInResponseTo($requestID);
        $ar->setRelayState($relayState);
        $ar->setStatus(array('Code' => $error->getStatus(), 'SubCode' => $error->getSubStatus(), 'Message' => $error->getStatusMessage()));
        $binding = new SAML2_HTTPPost();
        $binding->setDestination(sspmod_SAML2_Message::getDebugDestination());
        $binding->send($ar);
    } catch (Exception $e) {
        SimpleSAML_Utilities::fatalError($session->getTrackID(), 'GENERATEAUTHNRESPONSE', $e);
    }
}
All Usage Examples Of SimpleSAML_Utilities::fatalError