ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
CAS_ProxyChain Class Reference

A normal proxy-chain definition that lists each level of the chain as either a string or regular expression. More...

+ Inheritance diagram for CAS_ProxyChain:
+ Collaboration diagram for CAS_ProxyChain:

Public Member Functions

 __construct (array $chain)
 A chain is an array of strings or regexp strings that will be matched against. More...
 
 matches (array $list)
 Match a list of proxies. More...
 
 matches (array $list)
 Match a list of proxies. More...
 

Protected Member Functions

 isSizeValid (array $list)
 Validate the size of the the list as compared to our chain. More...
 

Protected Attributes

 $chain = array()
 

Detailed Description

A normal proxy-chain definition that lists each level of the chain as either a string or regular expression.

Definition at line 42 of file ProxyChain.php.

Constructor & Destructor Documentation

◆ __construct()

CAS_ProxyChain::__construct ( array  $chain)

A chain is an array of strings or regexp strings that will be matched against.

Regexp will be matched with preg_match and strings will be matched from the beginning. A string must fully match the beginning of an proxy url. So you can define a full domain as acceptable or go further down. Proxies have to be defined in reverse from the service to the user. If a user hits service A get proxied via B to service C the list of acceptable proxies on C would be array(B,A);

Parameters
array$chainA chain of proxies

Definition at line 60 of file ProxyChain.php.

61 {
62 // Ensure that we have an indexed array
63 $this->chain = array_values($chain);
64 }

References $chain.

Member Function Documentation

◆ isSizeValid()

CAS_ProxyChain::isSizeValid ( array  $list)
protected

Validate the size of the the list as compared to our chain.

Parameters
array$listList of proxies
Returns
bool

Reimplemented in CAS_ProxyChain_Trusted.

Definition at line 123 of file ProxyChain.php.

124 {
125 return (sizeof($this->chain) == sizeof($list));
126 }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41

References $list.

Referenced by matches().

+ Here is the caller graph for this function:

◆ matches()

CAS_ProxyChain::matches ( array  $list)

Match a list of proxies.

Parameters
array$listThe list of proxies in front of this service.
Returns
bool

Reimplemented from CAS_ProxyChain_Interface.

Definition at line 73 of file ProxyChain.php.

74 {
75 $list = array_values($list); // Ensure that we have an indexed array
76 if ($this->isSizeValid($list)) {
77 $mismatch = false;
78 foreach ($this->chain as $i => $search) {
79 $proxy_url = $list[$i];
80 if (preg_match('/^\/.*\/[ixASUXu]*$/s', $search)) {
81 if (preg_match($search, $proxy_url)) {
83 "Found regexp " . $search . " matching " . $proxy_url
84 );
85 } else {
87 "No regexp match " . $search . " != " . $proxy_url
88 );
89 $mismatch = true;
90 break;
91 }
92 } else {
93 if (strncasecmp($search, $proxy_url, strlen($search)) == 0) {
95 "Found string " . $search . " matching " . $proxy_url
96 );
97 } else {
99 "No match " . $search . " != " . $proxy_url
100 );
101 $mismatch = true;
102 break;
103 }
104 }
105 }
106 if (!$mismatch) {
107 phpCAS::trace("Proxy chain matches");
108 return true;
109 }
110 } else {
111 phpCAS::trace("Proxy chain skipped: size mismatch");
112 }
113 return false;
114 }
isSizeValid(array $list)
Validate the size of the the list as compared to our chain.
Definition: ProxyChain.php:123
$i
Definition: disco.tpl.php:19
static trace($str)
This method is used to log something in debug mode.
Definition: CAS.php:579

References $i, $list, isSizeValid(), and phpCAS\trace().

+ Here is the call graph for this function:

Field Documentation

◆ $chain

CAS_ProxyChain::$chain = array()
protected

Definition at line 46 of file ProxyChain.php.

Referenced by __construct().


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