ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
CAS_ProxyChain_AllowedList Class Reference

ProxyChain is a container for storing chains of valid proxies that can be used to validate proxied requests to a service. More...

+ Collaboration diagram for CAS_ProxyChain_AllowedList:

Public Member Functions

 isProxyingAllowed ()
 Check whether proxies are allowed by configuration. More...
 
 allowProxyChain (CAS_ProxyChain_Interface $chain)
 Add a chain of proxies to the list of possible chains. More...
 
 isProxyListAllowed (array $proxies)
 Check if the proxies found in the response match the allowed proxies. More...
 
 contains (array $list)
 Validate the proxies from the proxy ticket validation against the chains that were definded. More...
 

Private Attributes

 $_chains = array()
 

Detailed Description

ProxyChain is a container for storing chains of valid proxies that can be used to validate proxied requests to a service.

Definition at line 43 of file AllowedList.php.

Member Function Documentation

◆ allowProxyChain()

CAS_ProxyChain_AllowedList::allowProxyChain ( CAS_ProxyChain_Interface  $chain)

Add a chain of proxies to the list of possible chains.

Parameters
CAS_ProxyChain_Interface$chainA chain of proxies
Returns
void

Definition at line 65 of file AllowedList.php.

66  {
67  $this->_chains[] = $chain;
68  }

◆ contains()

CAS_ProxyChain_AllowedList::contains ( array  $list)

Validate the proxies from the proxy ticket validation against the chains that were definded.

Parameters
array$listList of proxies from the proxy ticket validation.
Returns
if any chain fully matches the supplied list

Definition at line 103 of file AllowedList.php.

References phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by isProxyListAllowed().

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  }
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:638
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:579
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:591
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isProxyingAllowed()

CAS_ProxyChain_AllowedList::isProxyingAllowed ( )

Check whether proxies are allowed by configuration.

Returns
bool

Definition at line 53 of file AllowedList.php.

Referenced by isProxyListAllowed().

54  {
55  return (count($this->_chains) > 0);
56  }
+ Here is the caller graph for this function:

◆ isProxyListAllowed()

CAS_ProxyChain_AllowedList::isProxyListAllowed ( array  $proxies)

Check if the proxies found in the response match the allowed proxies.

Parameters
array$proxieslist of proxies to check
Returns
bool whether the proxies match the allowed proxies

Definition at line 77 of file AllowedList.php.

References $res, contains(), isProxyingAllowed(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

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);
91  return $res;
92  }
93  }
isProxyingAllowed()
Check whether proxies are allowed by configuration.
Definition: AllowedList.php:53
static traceEnd($res='')
This method is used to indicate the end of the execution of a function in debug mode.
Definition: CAS.php:638
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:579
static traceBegin()
This method is used to indicate the start of the execution of a function in debug mode...
Definition: CAS.php:591
contains(array $list)
Validate the proxies from the proxy ticket validation against the chains that were definded...
+ Here is the call graph for this function:

Field Documentation

◆ $_chains

CAS_ProxyChain_AllowedList::$_chains = array()
private

Definition at line 46 of file AllowedList.php.


The documentation for this class was generated from the following file: