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

Apache based authentication More...

+ Inheritance diagram for ilAuthApache:
+ Collaboration diagram for ilAuthApache:

Public Member Functions

 supportsRedirects ()
 Returns true, if the current auth mode allows redirection to e.g to loginScreen, public section... More...
 
 __construct ($storageDriver, $options='', $loginFunction='', $showLogin=true)
 Contructor. More...
 
 login ()
 

Private Attributes

 $apache_settings
 

Detailed Description

Apache based authentication

Author
Jan Posselt jposs.nosp@m.elt@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$id$

Definition at line 35 of file class.ilAuthApache.php.

Constructor & Destructor Documentation

◆ __construct()

ilAuthApache::__construct (   $storageDriver,
  $options = '',
  $loginFunction = '',
  $showLogin = true 
)

Contructor.

Returns
Parameters
object$a_container
object$a_addition_options,[optional]

Definition at line 55 of file class.ilAuthApache.php.

References $_POST, $_SERVER, $_SESSION, $lng, $options, APACHE_AUTH_TYPE_BY_FUNCTION, APACHE_AUTH_TYPE_DIRECT_MAPPING, APACHE_AUTH_TYPE_EXTENDED_MAPPING, AUTH_APACHE, defined, and ApacheCustom\getUsername().

56  {
57  global $lng;
58 
59  parent::__construct($storageDriver,$options, '', false);
60  $this->setSessionName("_authhttp".md5(CLIENT_ID));
61 
62  $this->apache_settings = new ilSetting('apache_auth');
63 
64  if (defined('IL_CERT_SSO') && IL_CERT_SSO) {
65  // DO NOT DELETE!!!
66  // faking post values is REQUIRED to avoid canceling of the
67  // startup routines
68  // $_POST['username'] = 'xxx';
69  $_POST['password'] = 'yyy';
70  $_POST['sendLogin'] = '1';
71  $_POST['auth_mode'] = AUTH_APACHE;
72  $_POST['cmd[butSubmit]'] = 'Submit';
73 
74  if ($_POST['username'] != 'anonymous') {
75 
76  switch($this->apache_settings->get('apache_auth_username_config_type'))
77  {
79  $_POST['username'] = $_SERVER[$this->apache_settings->get('apache_auth_username_direct_mapping_fieldname')];
80  break;
82  throw new ilException("APACHE_AUTH_TYPE_EXTENDED_MAPPING not yet implemented");
84  include_once 'Services/AuthApache/classes/custom_username_func.php';
85  $_POST['username'] = ApacheCustom::getUsername();
86  break;
87  }
88 
89  }
90  }
91 
92  if (defined('IL_CERT_SSO') && IL_CERT_SSO && !$_POST['username']) {
93  $_POST['username'] = '§invalid';
94  $_POST['password'] = 'anonymous';
95  $_SESSION['username_invalid'] = true;
96  }
97 
98  $this->initAuth();
99  }
ILIAS Setting Class.
Base class for ILIAS Exception handling.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$_SESSION["AccountId"]
const APACHE_AUTH_TYPE_DIRECT_MAPPING
const APACHE_AUTH_TYPE_BY_FUNCTION
const AUTH_APACHE
const APACHE_AUTH_TYPE_EXTENDED_MAPPING
if(!is_array($argv)) $options
global $lng
Definition: privfeed.php:17
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
$_POST["username"]
+ Here is the call graph for this function:

Member Function Documentation

◆ login()

ilAuthApache::login ( )

Definition at line 102 of file class.ilAuthApache.php.

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

102  {
103  $skipClasses = array('ilpasswordassistancegui', 'ilaccountregistrationgui');
104  $skipFiles = array('pwassist.php');
105  if(in_array(strtolower($_REQUEST['cmdClass']), $skipClasses))
106  {
107  return;
108  }
109  else
110  {
111  $script = pathinfo($_SERVER['PHP_SELF'], PATHINFO_BASENAME);
112  if(in_array(strtolower($script), $skipFiles))
113  return;
114  }
115  if(
116  !$this->apache_settings->get('apache_auth_authenticate_on_login_page') &&
117  (
118  preg_match('/.*login\.php$/', $_SERVER['SCRIPT_NAME']) ||
119  ((in_array($_REQUEST['cmd'], array('showLogin', 'showTermsOfService')) || isset($_POST['change_lang_to'])) && strtolower($_REQUEST['cmdClass']) == 'ilstartupgui')
120  )
121  )
122  {
123  return;
124  }
125 
126  if(!$this->apache_settings->get('apache_auth_authenticate_on_login_page') && preg_match('/.*login\.php$/', $_SERVER['SCRIPT_NAME']))
127  {
128  return;
129  }
130 
131  if (ilContext::supportsRedirects() && !isset($_GET['passed_sso']) && (!defined('IL_CERT_SSO') || IL_CERT_SSO == false)) {
132 
133  // redirect to sso
134  // this part is executed in default ilias context...
135 
136  $path = $_SERVER['REQUEST_URI'];
137 
138  if ($path{0} == '/') {
139  $path = substr($path, 1);
140  }
141 
142  if (substr($path, 0, 4) != 'http') {
143  $parts = parse_url(ILIAS_HTTP_PATH);
144  $path = $parts['scheme'] . '://' . $parts['host'] . '/' . $path;
145  }
146 
147  $path = urlencode($path);
148  ilUtil::redirect(ilUtil::getHtmlPath('/sso/index.php?force_mode_apache=1&r=' . $path . '&cookie_path='.IL_COOKIE_PATH . '&ilias_path=' . ILIAS_HTTP_PATH));
149  }
150  else {
151  return parent::login();
152  }
153  }
$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
Create styles array
The data for the language used.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
static redirect($a_script)
http redirect to other script
$_POST["username"]
static supportsRedirects()
Are redirects supported?
+ Here is the call graph for this function:

◆ supportsRedirects()

ilAuthApache::supportsRedirects ( )

Returns true, if the current auth mode allows redirection to e.g to loginScreen, public section...

Returns

Definition at line 44 of file class.ilAuthApache.php.

45  {
46  return true;
47  }

Field Documentation

◆ $apache_settings

ilAuthApache::$apache_settings
private

Definition at line 37 of file class.ilAuthApache.php.


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