Auth_OpenID_PAPE_Response::parseExtensionArgs PHP Method

parseExtensionArgs() public method

Parse the provider authentication policy arguments into the internal state of this object
public parseExtensionArgs ( $args, $strict = false ) : null
return null The data is parsed into the internal fields of this object.
    function parseExtensionArgs($args, $strict = false)
    {
        $policies_str = Auth_OpenID::arrayGet($args, 'auth_policies');
        if ($policies_str && $policies_str != "none") {
            $this->auth_policies = explode(" ", $policies_str);
        }
        $nist_level_str = Auth_OpenID::arrayGet($args, 'nist_auth_level');
        if ($nist_level_str !== null) {
            $nist_level = Auth_OpenID::intval($nist_level_str);
            if ($nist_level === false) {
                if ($strict) {
                    return false;
                } else {
                    $nist_level = null;
                }
            }
            if (0 <= $nist_level && $nist_level < 5) {
                $this->nist_auth_level = $nist_level;
            } else {
                if ($strict) {
                    return false;
                }
            }
        }
        $auth_time = Auth_OpenID::arrayGet($args, 'auth_time');
        if ($auth_time !== null) {
            if (preg_match(PAPE_TIME_VALIDATOR, $auth_time)) {
                $this->auth_time = $auth_time;
            } else {
                if ($strict) {
                    return false;
                }
            }
        }
    }

Usage Example

コード例 #1
0
ファイル: PAPE.php プロジェクト: marcioyonamine/php-openid
 /**
  * Create an Auth_OpenID_PAPE_Response object from a successful
  * OpenID library response.
  *
  * @param success_response $success_response A SuccessResponse
  * from Auth_OpenID_Consumer::complete()
  *
  * @returns: A provider authentication policy response from the
  * data that was supplied with the id_res response.
  */
 static function fromSuccessResponse($success_response)
 {
     $obj = new Auth_OpenID_PAPE_Response();
     // PAPE requires that the args be signed.
     $args = $success_response->getSignedNS(Auth_OpenID_PAPE_NS_URI);
     if ($args === null || $args === array()) {
         return null;
     }
     $result = $obj->parseExtensionArgs($args);
     if ($result === false) {
         return null;
     } else {
         return $obj;
     }
 }