コード例 #1
0
ファイル: Request.php プロジェクト: shupp/openid
 /**
  * Gets the auth request message in a URL format suitable for redirection.  The
  * decision about whether to use directed identity or not id done here.
  * 
  * @return string The URL to redirect the User-Agent to
  */
 public function getAuthorizeURL()
 {
     $version = OpenID::$versionMap[$this->serviceEndpoint->getVersion()];
     if ($this->serviceEndpoint->getVersion() == OpenID::SERVICE_2_0_SERVER) {
         $this->message->set('openid.claimed_id', OpenID::NS_2_0_ID_SELECT);
         $this->message->set('openid.identity', OpenID::NS_2_0_ID_SELECT);
     } else {
         $localID = $this->serviceEndpoint->getLocalID();
         if (!empty($localID)) {
             if ($version == OpenID::NS_2_0) {
                 $this->message->set('openid.claimed_id', $this->identifier);
             }
             $this->message->set('openid.identity', $localID);
         } else {
             if ($version == OpenID::NS_2_0) {
                 $this->message->set('openid.claimed_id', $this->identifier);
             }
             $this->message->set('openid.identity', $this->identifier);
         }
     }
     if ($version == OpenID::NS_1_1) {
         $this->addNonce();
     }
     $urls = $this->serviceEndpoint->getURIs();
     if (strstr($urls[0], '?')) {
         $url = $urls[0] . '&' . $this->message->getHTTPFormat();
     } else {
         $url = $urls[0] . '?' . $this->message->getHTTPFormat();
     }
     $netURL = new Net_URL2($url);
     return $netURL->getURL();
 }
コード例 #2
0
ファイル: ServiceEndpointTest.php プロジェクト: shupp/openid
 /**
  * Tests that getting and setting the version variable works properly
  *
  * @return void
  */
 public function testGetSetVersion()
 {
     $testVersion = 'http://specs.openid.net/auth/2.0/server';
     $version = $this->object->getVersion();
     $this->assertNull($version);
     $this->object->setVersion($testVersion);
     $version = $this->object->getVersion();
     $this->assertEquals($testVersion, $version);
 }