• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • Examples
  • File List
  • File Members

CAS/ProxiedService/Abstract.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003  * Copyright � 2003-2010, The ESUP-Portail consortium & the JA-SIG Collaborative.
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions are met:
00008  *
00009  *               * Redistributions of source code must retain the above copyright notice,
00010  *                       this list of conditions and the following disclaimer.
00011  *               * Redistributions in binary form must reproduce the above copyright notice,
00012  *                       this list of conditions and the following disclaimer in the documentation
00013  *                       and/or other materials provided with the distribution.
00014  *               * Neither the name of the ESUP-Portail consortium & the JA-SIG
00015  *                       Collaborative nor the names of its contributors may be used to endorse or
00016  *                       promote products derived from this software without specific prior
00017  *                       written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00020  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
00023  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00024  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00026  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00028  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029  */
00030 
00031 require_once(dirname(__FILE__).'/../ProxiedService.php');
00032 require_once(dirname(__FILE__).'/Testable.php');
00033 include_once(dirname(__FILE__).'/../InvalidArgumentException.php');
00034 include_once(dirname(__FILE__).'/../OutOfSequenceException.php');
00035 
00036 
00041 abstract class CAS_ProxiedService_Abstract
00042         implements CAS_ProxiedService, CAS_ProxiedService_Testable
00043 {
00044         
00049         private $_proxyTicket;
00050         
00059         public function setProxyTicket ($proxyTicket) {
00060                 if (empty($proxyTicket))
00061                         throw new CAS_InvalidArgumentException("Trying to initialize with an empty proxy ticket.");
00062                 if (!empty($this->_proxyTicket))
00063                         throw new CAS_OutOfSequenceException('Already initialized, cannot change the proxy ticket.');
00064                 
00065                 $this->_proxyTicket = $proxyTicket;
00066         }
00067         
00074         protected function getProxyTicket () {
00075                 if (empty($this->_proxyTicket))
00076                         throw new CAS_OutOfSequenceException('No proxy ticket yet. Call $this->initializeProxyTicket() to aquire the proxy ticket.');
00077                 
00078                 return $this->_proxyTicket;
00079         }
00080         
00084         private $_casClient;
00085         
00097         public function setCasClient (CAS_Client $casClient) {
00098                 if (!empty($this->_proxyTicket))
00099                         throw new CAS_OutOfSequenceException('Already initialized, cannot change the CAS_Client.');
00100                 
00101                 $this->_casClient = $casClient;
00102         }
00103         
00113         protected function initializeProxyTicket() {
00114                 if (!empty($this->_proxyTicket))
00115                         throw new CAS_OutOfSequenceException('Already initialized, cannot initialize again.');
00116                 
00117                 // Allow usage of a particular CAS_Client for unit testing.
00118                 if (empty($this->_casClient))
00119                         phpCAS::initializeProxiedService($this);
00120                 else
00121                         $this->_casClient->initializeProxiedService($this);
00122         }
00123         
00124 }

Generated on Sun Jun 5 2011 19:05:26 for phpCAS by  doxygen 1.7.1