function &doDiscover($openid_url) { $disco = $this->getDiscoveryObject($this->session, $openid_url, $this->session_key_prefix); // Set the 'stale' attribute of the manager. If discovery // fails in a fatal way, the stale flag will cause the manager // to be cleaned up next time discovery is attempted. $m = $disco->getManager(); $loader = new Auth_Yadis_ManagerLoader(); if ($m) { if ($m->stale) { $disco->destroyManager(); } else { $m->stale = true; $disco->session->set($disco->session_key, serialize($loader->toSession($m))); } } $endpoint = $disco->getNextService($this->discoverMethod, $this->consumer->fetcher); // Reset the 'stale' attribute of the manager. $m =& $disco->getManager(); if ($m) { $m->stale = false; $disco->session->set($disco->session_key, serialize($loader->toSession($m))); } return $endpoint; }
/** * @access private */ function createManager($services, $yadis_url = null) { $key = $this->getSessionKey(); if ($this->getManager()) { return $this->getManager(); } if ($services) { $loader = new Auth_Yadis_ManagerLoader(); $manager = new Auth_Yadis_Manager($this->url, $yadis_url, $services, $key); $this->session->set($this->session_key, serialize($loader->toSession($manager))); return $manager; } }
/** * Start the OpenID authentication process. See steps 1-2 in the * overview at the top of this file. * * @param string $user_url Identity URL given by the user. This * method performs a textual transformation of the URL to try and * make sure it is normalized. For example, a user_url of * example.com will be normalized to http://example.com/ * normalizing and resolving any redirects the server might issue. * * @param bool $anonymous True if the OpenID request is to be sent * to the server without any identifier information. Use this * when you want to transport data but don't want to do OpenID * authentication with identifiers. * * @return Auth_OpenID_AuthRequest $auth_request An object * containing the discovered information will be returned, with a * method for building a redirect URL to the server, as described * in step 3 of the overview. This object may also be used to add * extension arguments to the request, using its 'addExtensionArg' * method. */ function begin($user_url, $anonymous = false) { $openid_url = $user_url; $disco = $this->getDiscoveryObject($this->session, $openid_url, $this->session_key_prefix); // Set the 'stale' attribute of the manager. If discovery // fails in a fatal way, the stale flag will cause the manager // to be cleaned up next time discovery is attempted. $m = $disco->getManager(); $loader = new Auth_Yadis_ManagerLoader(); // kh // var_dump($m); if ($m) { if ($m->stale) { $disco->destroyManager(); } else { $m->stale = true; $disco->session->set($disco->session_key, serialize($loader->toSession($m))); } } $endpoint = $disco->getNextService($this->discoverMethod, $this->consumer->fetcher); //var_dump($endpoint);die; // Reset the 'stale' attribute of the manager. $m = $disco->getManager(); if ($m) { $m->stale = false; $disco->session->set($disco->session_key, serialize($loader->toSession($m))); } if ($endpoint === null) { //file_put_contents("log.txt", "錯誤的OpenID(URL) 或 discover fail: no OP server endpoint,檢查XRDS檔案的設置路徑\n", FILE_APPEND); $error = "錯誤的OpenID(URL) 或 discover fail: no OP server endpoint,檢查XRDS檔案的設置路徑"; // include 'test_index.php'; exit(0); // return null; } else { return $this->beginWithoutDiscovery($endpoint, $anonymous); } }