Default.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_InfoCard
  17. * @subpackage Zend_InfoCard_Xml
  18. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * Zend_InfoCard_Xml_KeyInfo_Abstract
  24. */
  25. require_once 'Zend/InfoCard/Xml/KeyInfo/Abstract.php';
  26. /**
  27. * Zend_InfoCard_Xml_SecurityTokenReference
  28. */
  29. require_once 'Zend/InfoCard/Xml/SecurityTokenReference.php';
  30. /**
  31. * An object representation of a XML <KeyInfo> block which doesn't provide a namespace
  32. * In this context, it is assumed to mean that it is the type of KeyInfo block which
  33. * contains the SecurityTokenReference
  34. *
  35. * @category Zend
  36. * @package Zend_InfoCard
  37. * @subpackage Zend_InfoCard_Xml
  38. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  39. * @license http://framework.zend.com/license/new-bsd New BSD License
  40. */
  41. class Zend_InfoCard_Xml_KeyInfo_Default extends Zend_InfoCard_Xml_KeyInfo_Abstract
  42. {
  43. /**
  44. * Returns the object representation of the SecurityTokenReference block
  45. *
  46. * @throws Zend_InfoCard_Xml_Exception
  47. * @return Zend_InfoCard_Xml_SecurityTokenReference
  48. */
  49. public function getSecurityTokenReference()
  50. {
  51. $this->registerXPathNamespace('o', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd');
  52. list($sectokenref) = $this->xpath('//o:SecurityTokenReference');
  53. if(!($sectokenref instanceof Zend_InfoCard_Xml_Element)) {
  54. throw new Zend_InfoCard_Xml_Exception('Could not locate the Security Token Reference');
  55. }
  56. return Zend_InfoCard_Xml_SecurityTokenReference::getInstance($sectokenref);
  57. }
  58. }