ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
ilAuthFrontendCredentialsApache Class Reference

Description of class class. More...

+ Inheritance diagram for ilAuthFrontendCredentialsApache:
+ Collaboration diagram for ilAuthFrontendCredentialsApache:

Public Member Functions

 __construct ()
 Constructor. More...
 
 tryAuthenticationOnLoginPage ()
 Check if an authentication attempt should be done when login page has been called. More...
 
 initFromRequest ()
 Init credentials from request. More...
 
 hasValidTargetUrl ()
 
 getTargetUrl ()
 
- Public Member Functions inherited from ilAuthFrontendCredentials
 __construct ()
 
 getLogger ()
 Get logger. More...
 
 setUsername ($a_name)
 Set username. More...
 
 getUsername ()
 Get username. More...
 
 setPassword ($a_password)
 Set password. More...
 
 getPassword ()
 Get password. More...
 
 setCaptchaCode ($a_code)
 Set captcha code. More...
 
 getCaptchaCode ()
 Get captcha code. More...
 
 setAuthMode ($a_auth_mode)
 Set auth mode. More...
 
 getAuthMode ()
 Get auth mode. More...
 

Protected Member Functions

 getSettings ()
 

Private Attributes

 $settings = null
 

Detailed Description

Description of class class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 13 of file class.ilAuthFrontendCredentialsApache.php.

Constructor & Destructor Documentation

◆ __construct()

ilAuthFrontendCredentialsApache::__construct ( )

Constructor.

Definition at line 20 of file class.ilAuthFrontendCredentialsApache.php.

References settings().

21  {
22  parent::__construct();
23 
24  include_once './Services/Administration/classes/class.ilSetting.php';
25  $this->settings = new ilSetting('apache_auth');
26  }
ILIAS Setting Class.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ getSettings()

ilAuthFrontendCredentialsApache::getSettings ( )
protected
Returns

Definition at line 83 of file class.ilAuthFrontendCredentialsApache.php.

References $settings.

Referenced by initFromRequest(), and tryAuthenticationOnLoginPage().

+ Here is the caller graph for this function:

◆ getTargetUrl()

ilAuthFrontendCredentialsApache::getTargetUrl ( )
Returns
string

Definition at line 167 of file class.ilAuthFrontendCredentialsApache.php.

References $_GET, and ilUtil\appendUrlParameterString().

168  {
169  return ilUtil::appendUrlParameterString(trim($_GET['r']), 'passed_sso=1');
170  }
$_GET["client_id"]
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
+ Here is the call graph for this function:

◆ hasValidTargetUrl()

ilAuthFrontendCredentialsApache::hasValidTargetUrl ( )
Returns
bool

Definition at line 117 of file class.ilAuthFrontendCredentialsApache.php.

References $_GET, $path, $url, array, and file.

118  {
119  if(!isset($_GET['r']) || 0 == strlen(trim($_GET['r'])))
120  {
121  return false;
122  }
123 
124  $url = trim($_GET['r']);
125 
126  $validDomains = array();
127  $path = ILIAS_DATA_DIR . '/' . CLIENT_ID . '/apache_auth_allowed_domains.txt';
128  if(file_exists($path) && is_readable($path))
129  {
130  foreach(file($path) as $line)
131  {
132  if(trim($line))
133  {
134  $validDomains[] = trim($line);
135  }
136  }
137  }
138 
139  $urlParts = parse_url($url);
140  $redirectDomain = $urlParts['host'];
141 
142  $validRedirect = false;
143  foreach($validDomains as $validDomain)
144  {
145  if($redirectDomain === $validDomain)
146  {
147  $validRedirect = true;
148  break;
149  }
150 
151  if(strlen($redirectDomain) > (strlen($validDomain) + 1))
152  {
153  if(substr($redirectDomain, (0 - strlen($validDomain) - 1)) === '.' . $validDomain)
154  {
155  $validRedirect = true;
156  break;
157  }
158  }
159  }
160 
161  return $validRedirect;
162  }
$path
Definition: aliased.php:25
$_GET["client_id"]
$url
Definition: shib_logout.php:72
Reload workbook from saved file
Create styles array
The data for the language used.

◆ initFromRequest()

ilAuthFrontendCredentialsApache::initFromRequest ( )

Init credentials from request.

Definition at line 91 of file class.ilAuthFrontendCredentialsApache.php.

References $_SERVER, ilAuthProviderApache\APACHE_AUTH_TYPE_BY_FUNCTION, ilAuthProviderApache\APACHE_AUTH_TYPE_DIRECT_MAPPING, ilLogLevel\DEBUG, ilAuthFrontendCredentials\getLogger(), getSettings(), ApacheCustom\getUsername(), and ilAuthFrontendCredentials\setUsername().

92  {
93  $this->getLogger()->dump($_SERVER, ilLogLevel::DEBUG);
94  $this->getLogger()->debug($this->getSettings()->get('apache_auth_username_direct_mapping_fieldname', ''));
95 
96  include_once './Services/AuthApache/classes/class.ilAuthProviderApache.php';
97 
98  switch($this->getSettings()->get('apache_auth_username_config_type'))
99  {
101  if(array_key_exists($this->getSettings()->get('apache_auth_username_direct_mapping_fieldname'), $_SERVER))
102  {
103  $this->setUsername($_SERVER[$this->getSettings()->get('apache_auth_username_direct_mapping_fieldname', '')]);
104  }
105  break;
106 
108  include_once 'Services/AuthApache/classes/custom_username_func.php';
110  break;
111  }
112  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
+ Here is the call graph for this function:

◆ tryAuthenticationOnLoginPage()

ilAuthFrontendCredentialsApache::tryAuthenticationOnLoginPage ( )

Check if an authentication attempt should be done when login page has been called.

Redirects in case no apache authentication has been tried before (GET['passed_sso'])

Definition at line 32 of file class.ilAuthFrontendCredentialsApache.php.

References $_GET, $_SERVER, $path, defined, ilUtil\getHtmlPath(), getSettings(), IL_COOKIE_PATH, ilUtil\redirect(), and ilContext\supportsRedirects().

33  {
34  if(strcmp((string) $_REQUEST['cmd'], 'force_login') === 0)
35  {
36  return false;
37  }
38 
39  if(!$this->getSettings()->get('apache_enable_auth',false))
40  {
41  return false;
42  }
43 
44  if(!$this->getSettings()->get('apache_auth_authenticate_on_login_page',false))
45  {
46  return false;
47  }
48 
49  if(
51  isset($_GET['passed_sso']) ||
52  (defined('IL_CERT_SSO') && IL_CERT_SSO == '1')
53  )
54  {
55  return false;
56  }
57 
58  $path = $_SERVER['REQUEST_URI'];
59  if(substr($path,0,1) === '/')
60  {
61  $path = substr($path, 1);
62  }
63 
64  if(substr($path, 0, 4) !== 'http')
65  {
66  $parts = parse_url(ILIAS_HTTP_PATH);
67  $path = $parts['scheme'] . '://'. $parts['host'] . '/' . $path;
68  }
69 
72  './sso/index.php?force_mode_apache=1&' .
73  'r=' . urlencode($path) .
74  '&cookie_path=' . urlencode(IL_COOKIE_PATH) .
75  '&ilias_path=' . urlencode(ILIAS_HTTP_PATH)
76  )
77  );
78  }
$path
Definition: aliased.php:25
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$_GET["client_id"]
const IL_COOKIE_PATH(isset($_GET["client_id"]))
Definition: index.php:26
static getHtmlPath($relative_path)
get url of path
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
static redirect($a_script)
http redirect to other script
static supportsRedirects()
Are redirects supported?
+ Here is the call graph for this function:

Field Documentation

◆ $settings

ilAuthFrontendCredentialsApache::$settings = null
private

Definition at line 15 of file class.ilAuthFrontendCredentialsApache.php.

Referenced by getSettings().


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