/** * Validates and performs discovery on the openid.claimed_id paramter. * * @return void * @throws OpenID_Assertion_Exception on failure */ protected function validateDiscover() { $claimedID = $this->message->get('openid.claimed_id'); if ($claimedID === null) { throw new OpenID_Assertion_Exception_NoClaimedID('No claimed_id in message'); } if ($claimedID === OpenID::SERVICE_2_0_SERVER) { throw new OpenID_Assertion_Exception('Claimed identifier cannot be an OP identifier'); } $url = new Net_URL2($claimedID); // Remove the fragment, per the spec $url->setFragment(false); $discover = $this->getDiscover($url->getURL()); if (!$discover instanceof OpenID_Discover) { throw new OpenID_Assertion_Exception('Unable to discover claimed_id'); } $URIs = $discover->services[0]->getURIs(); $opURL = array_shift($URIs); if ($opURL !== $this->message->get('openid.op_endpoint')) { throw new OpenID_Assertion_Exception('This OP is not authorized to issue assertions for this claimed id'); } }
/** * Tests setting the fragment. */ public function testSetFragment() { $url = new Net_URL2('http://www.example.com/'); $url->setFragment('pear'); $this->assertEquals('http://www.example.com/#pear', $url->getURL()); }