phpCAS  version 1.4.0
AllowedList.php
Go to the documentation of this file.
1 <?php
2 
44 {
45 
46  private $_chains = array();
47 
53  public function isProxyingAllowed()
54  {
55  return (count($this->_chains) > 0);
56  }
57 
65  public function allowProxyChain(CAS_ProxyChain_Interface $chain)
66  {
67  $this->_chains[] = $chain;
68  }
69 
77  public function isProxyListAllowed(array $proxies)
78  {
80  if (empty($proxies)) {
81  phpCAS::trace("No proxies were found in the response");
82  phpCAS::traceEnd(true);
83  return true;
84  } elseif (!$this->isProxyingAllowed()) {
85  phpCAS::trace("Proxies are not allowed");
86  phpCAS::traceEnd(false);
87  return false;
88  } else {
89  $res = $this->contains($proxies);
90  phpCAS::traceEnd($res);
91  return $res;
92  }
93  }
94 
103  public function contains(array $list)
104  {
106  $count = 0;
107  foreach ($this->_chains as $chain) {
108  phpCAS::trace("Checking chain ". $count++);
109  if ($chain->matches($list)) {
110  phpCAS::traceEnd(true);
111  return true;
112  }
113  }
114  phpCAS::trace("No proxy chain matches.");
115  phpCAS::traceEnd(false);
116  return false;
117  }
118 }
119 ?>
static traceEnd($res='')
Definition: CAS.php:675
static trace($str)
Definition: CAS.php:616
isProxyListAllowed(array $proxies)
Definition: AllowedList.php:77
static traceBegin()
Definition: CAS.php:628
allowProxyChain(CAS_ProxyChain_Interface $chain)
Definition: AllowedList.php:65