예제 #1
0
 /**
  * Called to interpret the server's response to an OpenID
  * request. It is called in step 4 of the flow described in the
  * consumer overview.
  *
  * @param array $query An array of the query parameters (key =>
  * value pairs) for this HTTP request.
  *
  * @return Auth_OpenID_ConsumerResponse $response A instance of an
  * Auth_OpenID_ConsumerResponse subclass. The type of response is
  * indicated by the status attribute, which will be one of
  * SUCCESS, CANCEL, FAILURE, or SETUP_NEEDED.
  */
 function complete($query)
 {
     $query = Auth_OpenID::fixArgs($query);
     $loader = new Auth_OpenID_ServiceEndpointLoader();
     $endpoint_data = $this->session->get($this->_token_key);
     $endpoint = $loader->fromSession($endpoint_data);
     if ($endpoint === null) {
         $response = new Auth_OpenID_FailureResponse(null, 'No session state found');
     } else {
         $response = $this->consumer->complete($query, $endpoint);
         $this->session->del($this->_token_key);
     }
     if (in_array($response->status, array(Auth_OpenID_SUCCESS, Auth_OpenID_CANCEL))) {
         if ($response->identity_url !== null) {
             $disco = new Services_Yadis_Discovery($this->session, $response->identity_url, $this->session_key_prefix);
             $disco->cleanup();
         }
     }
     return $response;
 }