ILIAS  release_7 Revision v7.30-3-g800a261c036
AllowedList.php
Go to the documentation of this file.
1<?php
2
44{
45 private $_chains = array();
46
52 public function isProxyingAllowed()
53 {
54 return (count($this->_chains) > 0);
55 }
56
65 {
66 $this->_chains[] = $chain;
67 }
68
76 public function isProxyListAllowed(array $proxies)
77 {
79 if (empty($proxies)) {
80 phpCAS::trace("No proxies were found in the response");
81 phpCAS::traceEnd(true);
82 return true;
83 } elseif (!$this->isProxyingAllowed()) {
84 phpCAS::trace("Proxies are not allowed");
85 phpCAS::traceEnd(false);
86 return false;
87 } else {
88 $res = $this->contains($proxies);
90 return $res;
91 }
92 }
93
102 public function contains(array $list)
103 {
105 $count = 0;
106 foreach ($this->_chains as $chain) {
107 phpCAS::trace("Checking chain " . $count++);
108 if ($chain->matches($list)) {
109 phpCAS::traceEnd(true);
110 return true;
111 }
112 }
113 phpCAS::trace("No proxy chain matches.");
114 phpCAS::traceEnd(false);
115 return false;
116 }
117}
An exception for terminatinating execution or to throw for unit testing.
ProxyChain is a container for storing chains of valid proxies that can be used to validate proxied re...
Definition: AllowedList.php:44
allowProxyChain(CAS_ProxyChain_Interface $chain)
Add a chain of proxies to the list of possible chains.
Definition: AllowedList.php:64
isProxyListAllowed(array $proxies)
Check if the proxies found in the response match the allowed proxies.
Definition: AllowedList.php:76
contains(array $list)
Validate the proxies from the proxy ticket validation against the chains that were definded.
isProxyingAllowed()
Check whether proxies are allowed by configuration.
Definition: AllowedList.php:52
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:599
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:658
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode.
Definition: CAS.php:611
An interface for classes that define a list of allowed proxies in front of the current application.
Definition: Interface.php:42
foreach($_POST as $key=> $value) $res