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\AbstractElement) {
         throw new \Zend\InfoCard\XML\Exception\RuntimeException('Could not locate the Security Token Reference');
     }
     return \Zend\InfoCard\XML\SecurityTokenReference::getInstance($sectokenref);
 }
Esempio n. 2
0
    public function testSecurityTokenReferenceThrowsExceptionsOnKeyReferenceRetrievalWithInvalidXml()
    {
        $doc = file_get_contents(__DIR__ . "/_files/security_token_bad_keyref.xml");

        $this->setExpectedException('Zend\InfoCard\XML\Exception\RuntimeException', 'Unknown Key Reference Encoding Type:');
        $si = XML\SecurityTokenReference::getInstance($doc);
        $si->getKeyReference();
    }
Esempio n. 3
0
 public function testSecurityTokenReferenceErrors()
 {
     try {
         XML\SecurityTokenReference::getInstance("<foo/>");
         $this->fail("Expected Exception Not thrown");
     } catch (\Exception $e) {
         /* yay */
     }
     try {
         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 = XML\SecurityTokenReference::getInstance($doc);
         $si->getKeyReference();
         $this->fail("Expected Exception Not thrown");
     } catch (\Exception $e) {
         /* yay */
     }
 }