Exemple #1
0
 /**
  * Create a C{L{SRegResponse}} object from a successful OpenID
  * library response
  * (C{L{openid.consumer.consumer.SuccessResponse}}) response
  * message
  *
  * success_response: A SuccessResponse from consumer.complete()
  *
  * signed_only: Whether to process only data that was
  * signed in the id_res message from the server.
  *
  * Returns a simple registration response containing the data that
  * was supplied with the C{id_res} response.
  */
 function fromSuccessResponse(&$success_response, $signed_only = true)
 {
     global $Auth_OpenID_sreg_data_fields;
     $obj = new Auth_OpenID_SRegResponse();
     $obj->ns_uri = $obj->_getSRegNS($success_response->message);
     if ($signed_only) {
         $args = $success_response->getSignedNS($obj->ns_uri);
     } else {
         $args = $success_response->message->getArgs($obj->ns_uri);
     }
     if ($args === null || Auth_OpenID::isFailure($args)) {
         return null;
     }
     foreach ($Auth_OpenID_sreg_data_fields as $field_name => $desc) {
         if (in_array($field_name, array_keys($args))) {
             $obj->data[$field_name] = $args[$field_name];
         }
     }
     return $obj;
 }