/**
* Process the error/Exception returned from SimpleSaml and return an appropriate error to the user.
*
* @return SS_HTTPResponse
*/
private function realMeErrorHandler()
{
// Error handling, to prevent infinite login loops if there was an internal error with SimpleSAMLphp
if ($exceptionId = $this->owner->getRequest()->getVar('SimpleSAML_Auth_State_exceptionId')) {
if (is_string($exceptionId) && strlen($exceptionId) > 1) {
$authState = SimpleSAML_Auth_State::loadExceptionState($exceptionId);
if (true === array_key_exists('SimpleSAML_Auth_State.exceptionData', $authState) && $authState['SimpleSAML_Auth_State.exceptionData'] instanceof sspmod_saml_Error) {
$exception = $authState['SimpleSAML_Auth_State.exceptionData'];
$message = $this->getErrorMessage($exception);
SS_Log::log(sprintf('Error while validating RealMe authentication details: %s', $message), SS_Log::ERR);
return Security::permissionFailure($this->owner, $message);
}
}
}
SS_Log::log('Unknown error while attempting to parse RealMe authentication', SS_Log::ERR);
return Security::permissionFailure($this->owner, _t('RealMeSecurityExtension.GENERAL_ERROR', '', array('errorMsg' => 'Unknown')));
}