Esempio n. 1
0
 /**
  * Returns the object representation of the SecurityTokenReference block
  *
  * @throws Zend_InfoCard_Xml_Exception
  * @return Zend_InfoCard_Xml_SecurityTokenReference
  */
 public function getSecurityTokenReference()
 {
     $this->registerXPathNamespace('o', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd');
     list($sectokenref) = $this->xpath('//o:SecurityTokenReference');
     if (!$sectokenref instanceof Zend_InfoCard_Xml_Element) {
         throw new Zend_InfoCard_Xml_Exception('Could not locate the Security Token Reference');
     }
     return Zend_InfoCard_Xml_SecurityTokenReference::getInstance($sectokenref);
 }
Esempio n. 2
0
 public function testSecurityTokenReferenceErrors()
 {
     try {
         Zend_InfoCard_Xml_SecurityTokenReference::getInstance("<foo/>");
         $this->fail("Expected Exception Not thrown");
     } catch (Exception $e) {
         /* yay */
     }
     try {
         Zend_InfoCard_Xml_SecurityTokenReference::getInstance(10);
         $this->fail("Expected Exception Not thrown");
     } catch (Exception $e) {
         /* yay */
     }
     $doc = file_get_contents(dirname(__FILE__) . "/_files/security_token_bad_keyref.xml");
     try {
         $si = Zend_InfoCard_Xml_SecurityTokenReference::getInstance($doc);
         $si->getKeyReference();
         $this->fail("Expected Exception Not thrown");
     } catch (Exception $e) {
         /* yay */
     }
 }