ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 

Additional Inherited Members

- Static Public Member Functions inherited from SimpleSAML\Utils\Auth
static getAdminLoginURL ($returnTo=null)
 Retrieve a admin login URL. More...
 
static isAdmin ()
 Check whether the current user is admin. More...
 
static requireAdmin ()
 Require admin access to the current page. More...
 

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  switch ($this->apache_settings->get('apache_auth_username_config_type')) {
77  $_POST['username'] = $_SERVER[$this->apache_settings->get('apache_auth_username_direct_mapping_fieldname')];
78  break;
80  throw new ilException("APACHE_AUTH_TYPE_EXTENDED_MAPPING not yet implemented");
82  include_once 'Services/AuthApache/classes/custom_username_func.php';
83  $_POST['username'] = ApacheCustom::getUsername();
84  break;
85  }
86  }
87  }
88 
89  if (defined('IL_CERT_SSO') && IL_CERT_SSO && !$_POST['username']) {
90  $_POST['username'] = '§invalid';
91  $_POST['password'] = 'anonymous';
92  $_SESSION['username_invalid'] = true;
93  }
94 
95  $this->initAuth();
96  }
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
global $lng
Definition: privfeed.php:17
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
$_POST["username"]
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:

Member Function Documentation

◆ login()

ilAuthApache::login ( )

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

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

100  {
101  $skipClasses = array('ilpasswordassistancegui', 'ilaccountregistrationgui');
102  $skipFiles = array('pwassist.php');
103  if (in_array(strtolower($_REQUEST['cmdClass']), $skipClasses)) {
104  return;
105  } else {
106  $script = pathinfo($_SERVER['PHP_SELF'], PATHINFO_BASENAME);
107  if (in_array(strtolower($script), $skipFiles)) {
108  return;
109  }
110  }
111  if (
112  !$this->apache_settings->get('apache_auth_authenticate_on_login_page') &&
113  (
114  preg_match('/.*login\.php$/', $_SERVER['SCRIPT_NAME']) ||
115  ((in_array($_REQUEST['cmd'], array('showLogin', 'showTermsOfService')) || isset($_POST['change_lang_to'])) && strtolower($_REQUEST['cmdClass']) == 'ilstartupgui')
116  )
117  ) {
118  return;
119  }
120 
121  if (!$this->apache_settings->get('apache_auth_authenticate_on_login_page') && preg_match('/.*login\.php$/', $_SERVER['SCRIPT_NAME'])) {
122  return;
123  }
124 
125  if (ilContext::supportsRedirects() && !isset($_GET['passed_sso']) && (!defined('IL_CERT_SSO') || IL_CERT_SSO == false)) {
126 
127  // redirect to sso
128  // this part is executed in default ilias context...
129 
130  $path = $_SERVER['REQUEST_URI'];
131 
132  if ($path{0} == '/') {
133  $path = substr($path, 1);
134  }
135 
136  if (substr($path, 0, 4) != 'http') {
137  $parts = parse_url(ILIAS_HTTP_PATH);
138  $path = $parts['scheme'] . '://' . $parts['host'] . '/' . $path;
139  }
140 
141  $path = urlencode($path);
142  ilUtil::redirect(ilUtil::getHtmlPath('/sso/index.php?force_mode_apache=1&r=' . $path . '&cookie_path=' . IL_COOKIE_PATH . '&ilias_path=' . ILIAS_HTTP_PATH));
143  } else {
144  return parent::login();
145  }
146  }
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: metadata.php:36
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)
$_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: