ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 setLogger (ilLogger $logger)
 Set 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...
 
 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.

Reimplemented from ilAuthFrontendCredentials.

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

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

References settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ getSettings()

ilAuthFrontendCredentialsApache::getSettings ( )
protected
Returns
\ilSetting

Definition at line 77 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 151 of file class.ilAuthFrontendCredentialsApache.php.

152 {
153 return ilUtil::appendUrlParameterString(trim($_GET['r']), 'passed_sso=1');
154 }
$_GET["client_id"]
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string

References $_GET, and ilUtil\appendUrlParameterString().

+ Here is the call graph for this function:

◆ hasValidTargetUrl()

ilAuthFrontendCredentialsApache::hasValidTargetUrl ( )
Returns
bool

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

110 {
111 if (!isset($_GET['r']) || 0 == strlen(trim($_GET['r']))) {
112 return false;
113 }
114
115 $url = trim($_GET['r']);
116
117 $validDomains = array();
118 $path = ILIAS_DATA_DIR . '/' . CLIENT_ID . '/apache_auth_allowed_domains.txt';
119 if (file_exists($path) && is_readable($path)) {
120 foreach (file($path) as $line) {
121 if (trim($line)) {
122 $validDomains[] = trim($line);
123 }
124 }
125 }
126
127 $urlParts = parse_url($url);
128 $redirectDomain = $urlParts['host'];
129
130 $validRedirect = false;
131 foreach ($validDomains as $validDomain) {
132 if ($redirectDomain === $validDomain) {
133 $validRedirect = true;
134 break;
135 }
136
137 if (strlen($redirectDomain) > (strlen($validDomain) + 1)) {
138 if (substr($redirectDomain, (0 - strlen($validDomain) - 1)) === '.' . $validDomain) {
139 $validRedirect = true;
140 break;
141 }
142 }
143 }
144
145 return $validRedirect;
146 }
$url

References $_GET, $path, and $url.

◆ initFromRequest()

ilAuthFrontendCredentialsApache::initFromRequest ( )

Init credentials from request.

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

86 {
87 $this->getLogger()->dump($_SERVER, ilLogLevel::DEBUG);
88 $this->getLogger()->debug($this->getSettings()->get('apache_auth_username_direct_mapping_fieldname', ''));
89
90 include_once './Services/AuthApache/classes/class.ilAuthProviderApache.php';
91
92 switch ($this->getSettings()->get('apache_auth_username_config_type')) {
94 if (array_key_exists($this->getSettings()->get('apache_auth_username_direct_mapping_fieldname'), $_SERVER)) {
95 $this->setUsername($_SERVER[$this->getSettings()->get('apache_auth_username_direct_mapping_fieldname', '')]);
96 }
97 break;
98
100 include_once 'Services/AuthApache/classes/custom_username_func.php';
102 break;
103 }
104 }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

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

+ 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.

33 {
34 if (strcmp((string) $_REQUEST['cmd'], 'force_login') === 0) {
35 return false;
36 }
37
38 if (!$this->getSettings()->get('apache_enable_auth', false)) {
39 return false;
40 }
41
42 if (!$this->getSettings()->get('apache_auth_authenticate_on_login_page', false)) {
43 return false;
44 }
45
46 if (
48 isset($_GET['passed_sso']) ||
49 (defined('IL_CERT_SSO') && IL_CERT_SSO == '1')
50 ) {
51 return false;
52 }
53
54 $path = $_SERVER['REQUEST_URI'];
55 if (substr($path, 0, 1) === '/') {
56 $path = substr($path, 1);
57 }
58
59 if (substr($path, 0, 4) !== 'http') {
60 $parts = parse_url(ILIAS_HTTP_PATH);
61 $path = $parts['scheme'] . '://' . $parts['host'] . '/' . $path;
62 }
63
66 './sso/index.php?force_mode_apache=1&' .
67 'r=' . urlencode($path) .
68 '&cookie_path=' . urlencode(IL_COOKIE_PATH) .
69 '&ilias_path=' . urlencode(ILIAS_HTTP_PATH)
70 )
71 );
72 }
const IL_COOKIE_PATH(isset($_GET["client_id"]))
Definition: metadata.php:36
static supportsRedirects()
Are redirects supported?
static redirect($a_script)
static getHtmlPath($relative_path)
get url of path
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

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

+ 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: