SimpleSAML_Auth_State::loadExceptionState PHP Method

loadExceptionState() public static method

Retrieve an exception state.
public static loadExceptionState ( string | null $id = null ) : array | null
$id string | null The exception id. Can be NULL, in which case it will be retrieved from the request.
return array | null The state array with the exception, or NULL if no exception was thrown.
    public static function loadExceptionState($id = null)
    {
        assert('is_string($id) || is_null($id)');
        if ($id === null) {
            if (!array_key_exists(self::EXCEPTION_PARAM, $_REQUEST)) {
                // No exception
                return null;
            }
            $id = $_REQUEST[self::EXCEPTION_PARAM];
        }
        $state = self::loadState($id, self::EXCEPTION_STAGE);
        assert('array_key_exists(self::EXCEPTION_DATA, $state)');
        return $state;
    }

Usage Example

コード例 #1
0
 /**
  * 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')));
 }
All Usage Examples Of SimpleSAML_Auth_State::loadExceptionState