/** * 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; }
function test_managerServices() { global $__yadis_2entries_flipped_priority; $url = "http://bogus.xxx/"; $sess = new Tests_Auth_OpenID_DiscoverSession(); $m = new Services_Yadis_Discovery($sess, $url); $documents = array($url => array("application/xrds+xml", $__yadis_2entries_flipped_priority)); $fetcher = new _DiscoveryMockFetcher($documents); $expected = array("http://frank.livejournal.com/", "http://smoker.myopenid.com/"); foreach ($expected as $openid) { $s = $m->getNextService('_Auth_OpenID_discoverServiceList', $fetcher); $this->assertEquals($s->delegate, $openid); } }