web/lib/Zend/Service/DeveloperGarden/Response/SecurityTokenServer/SecurityTokenResponse.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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_Service
       
    17  * @subpackage DeveloperGarden
       
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id: SecurityTokenResponse.php 21189 2010-02-24 01:50:33Z stas $
       
    21  */
       
    22 
       
    23 /**
       
    24  * @see Zend_Service_DeveloperGarden_Response_ResponseAbstract
       
    25  */
       
    26 require_once 'Zend/Service/DeveloperGarden/Response/ResponseAbstract.php';
       
    27 
       
    28 /**
       
    29  * @see Zend_Service_DeveloperGarden_Response_SecurityTokenServer_Interface
       
    30  */
       
    31 require_once 'Zend/Service/DeveloperGarden/Response/SecurityTokenServer/Interface.php';
       
    32 
       
    33 /**
       
    34  * @category   Zend
       
    35  * @package    Zend_Service
       
    36  * @subpackage DeveloperGarden
       
    37  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    38  * @author     Marco Kaiser
       
    39  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    40  */
       
    41 class Zend_Service_DeveloperGarden_Response_SecurityTokenServer_SecurityTokenResponse
       
    42     extends Zend_Service_DeveloperGarden_Response_ResponseAbstract
       
    43     implements Zend_Service_DeveloperGarden_Response_SecurityTokenServer_Interface
       
    44 {
       
    45     /**
       
    46      * the token format, should be saml20
       
    47      *
       
    48      * @var string
       
    49      */
       
    50     public $tokenFormat = null;
       
    51 
       
    52     /**
       
    53      * the token encoding, should be text/xml
       
    54      *
       
    55      * @var string
       
    56      */
       
    57     public $tokenEncoding = null;
       
    58 
       
    59     /**
       
    60      * the tokenData should be a valid Assertion value
       
    61      *
       
    62      * @var unknown_type
       
    63      */
       
    64     public $tokenData = null;
       
    65 
       
    66     /**
       
    67      * returns the tokenData
       
    68      *
       
    69      * @return string
       
    70      */
       
    71     public function getTokenData()
       
    72     {
       
    73         if (empty($this->tokenData)) {
       
    74             require_once 'Zend/Service/DeveloperGarden/Response/Exception.php';
       
    75             throw new Zend_Service_DeveloperGarden_Response_Exception('No valid tokenData found.');
       
    76         }
       
    77 
       
    78         return $this->tokenData;
       
    79     }
       
    80 
       
    81     /**
       
    82      * returns the token format value
       
    83      *
       
    84      * @return string
       
    85      */
       
    86     public function getTokenFormat()
       
    87     {
       
    88         return $this->tokenFormat;
       
    89     }
       
    90 
       
    91     /**
       
    92      * returns the token encoding
       
    93      *
       
    94      * @return string
       
    95      */
       
    96     public function getTokenEncoding()
       
    97     {
       
    98         return $this->tokenEncoding;
       
    99     }
       
   100 
       
   101     /**
       
   102      * returns true if the stored token data is valid
       
   103      *
       
   104      * @return boolean
       
   105      */
       
   106     public function isValid()
       
   107     {
       
   108         /**
       
   109          * @todo implement the true token validation check
       
   110          */
       
   111         if (!empty($this->securityTokenData)) {
       
   112             return true;
       
   113         }
       
   114         return false;
       
   115     }
       
   116 }