ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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...
 __construct ($a_container, $a_addition_options=array())
 Contructor.
 login ()
 Login function.
- Public Member Functions inherited from Auth
 Auth ($storageDriver, $options= '', $loginFunction= '', $showLogin=true)
 Constructor.
applyAuthOptions (&$options)
 Set the Auth options.
 _loadStorage ()
 Load Storage Driver if not already loaded.
 assignData ()
 Assign data from login form to internal values.
 start ()
 Start new auth session.
 setExpire ($time, $add=false)
 Set the maximum expire time.
 setIdle ($time, $add=false)
 Set the maximum idle time.
 setSessionName ($name= 'session')
 Set name of the session to a customized value.
 setShowLogin ($showLogin=true)
 Should the login form be displayed if neccessary?
 setAllowLogin ($allowLogin=true)
 Should the login form be displayed if neccessary?
 setCheckAuthCallback ($checkAuthCallback)
 Register a callback function to be called whenever the validity of the login is checked The function will receive two parameters, the username and a reference to the auth object.
 setLoginCallback ($loginCallback)
 Register a callback function to be called on user login.
 setFailedLoginCallback ($loginFailedCallback)
 Register a callback function to be called on failed user login.
 setLogoutCallback ($logoutCallback)
 Register a callback function to be called on user logout.
 setAuthData ($name, $value, $overwrite=true)
 Register additional information that is to be stored in the session.
 getAuthData ($name=null)
 Get additional information that is stored in the session.
 setAuth ($username)
 Register variable in a session telling that the user has logged in successfully.
 setAdvancedSecurity ($flag=true)
 Enables advanced security checks.
 checkAuth ()
 Checks if there is a session with valid auth information.
 getAuth ()
 Has the user been authenticated?
 logout ()
 Logout function.
 updateIdle ()
 Update the idletime.
 getUsername ()
 Get the username.
 getStatus ()
 Get the current status.
 getPostUsernameField ()
 Gets the post varible used for the username.
 getPostPasswordField ()
 Gets the post varible used for the username.
 sessionValidThru ()
 Returns the time up to the session is valid.
 listUsers ()
 List all users that are currently available in the storage container.
 addUser ($username, $password, $additional= '')
 Add user to the storage container.
 removeUser ($username)
 Remove user from the storage container.
 changePassword ($username, $password)
 Change password for user in the storage container.
 log ($message, $level=AUTH_LOG_DEBUG)
 Log a message from the Auth system.
 _loadLogger ()
 Load Log object if not already loaded.
 attachLogObserver (&$observer)
 Attach an Observer to the Auth Log Source.
 _isAdvancedSecurityEnabled ($feature=null)
 Is advanced security enabled?
- Public Member Functions inherited from ilAuthBase
 getContainer ()
 Get container object.
 getExceededUserName ()

Private Attributes

 $apache_settings

Additional Inherited Members

- Static Public Member Functions inherited from Auth
_factory ($driver, $options= '')
 Return a storage driver based on $driver and $options.
 staticCheckAuth ($options=null)
 Statically checks if there is a session with valid auth information.
- Data Fields inherited from Auth
 $expire = 0
 $expired = false
 $idle = 0
 $idled = false
 $storage = ''
 $loginFunction = ''
 $showLogin = true
 $allowLogin = true
 $status = ''
 $username = ''
 $password = ''
 $checkAuthCallback = ''
 $loginCallback = ''
 $loginFailedCallback = ''
 $logoutCallback = ''
 $_sessionName = '_authsession'
 $version = "@version@"
 $advancedsecurity = false
 $_postUsername = 'username'
 $_postPassword = 'password'
 $session
 $server
 $post
 $cookie
 $authdata
 $authChecks = 0
 $logger = null
 $enableLogging = false
 $regenerateSessionId = false
- Protected Member Functions inherited from ilAuthBase
 initAuth ()
 Init auth object Enable logging, set callbacks...
 loginObserver ($a_username, $a_auth)
 Called after successful login.
 failedLoginObserver ($a_username, $a_auth)
 Called after failed login.
 checkAuthObserver ($a_username, $a_auth)
 Called after each check auth request.
 logoutObserver ($a_username, $a_auth)
 Called after logout.
- Protected Attributes inherited from ilAuthBase
 $sub_status = null
 $exceeded_user_name

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

ilAuthApache::__construct (   $a_container,
  $a_addition_options = array() 
)

Contructor.

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

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

References $_POST, $_SESSION, $lng, APACHE_AUTH_TYPE_BY_FUNCTION, APACHE_AUTH_TYPE_DIRECT_MAPPING, APACHE_AUTH_TYPE_EXTENDED_MAPPING, AUTH_APACHE, Auth\getUsername(), IL_CERT_SSO, ilAuthBase\initAuth(), and Auth\setSessionName().

{
global $lng;
parent::__construct($a_container,$a_addition_options,'',false);
$this->setSessionName("_authhttp".md5(CLIENT_ID));
$this->apache_settings = new ilSetting('apache_auth');
if (defined('IL_CERT_SSO') && IL_CERT_SSO) {
// DO NOT DELETE!!!
// faking post values is REQUIRED to avoid canceling of the
// startup routines
// $_POST['username'] = 'xxx';
$_POST['password'] = 'yyy';
$_POST['sendLogin'] = '1';
$_POST['auth_mode'] = AUTH_APACHE;
$_POST['cmd[butSubmit]'] = 'Submit';
if ($_POST['username'] != 'anonymous') {
switch($this->apache_settings->get('apache_auth_username_config_type'))
{
$_POST['username'] = $_SERVER[$this->apache_settings->get('apache_auth_username_direct_mapping_fieldname')];
break;
throw new ilException("APACHE_AUTH_TYPE_EXTENDED_MAPPING not yet implemented");
include_once 'Services/AuthApache/classes/custom_username_func.php';
break;
}
}
}
if (defined('IL_CERT_SSO') && IL_CERT_SSO && !$_POST['username']) {
$_POST['username'] = '§invalid';
$_POST['password'] = 'anonymous';
$_SESSION['username_invalid'] = true;
}
$this->initAuth();
}

+ Here is the call graph for this function:

Member Function Documentation

ilAuthApache::login ( )

Login function.

Returns
void private

Reimplemented from Auth.

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

References $_GET, $_POST, $_REQUEST, $path, ilUtil\getHtmlPath(), IL_CERT_SSO, IL_COOKIE_PATH, ilUtil\redirect(), and ilContext\supportsRedirects().

{
$skipClasses = array('ilpasswordassistancegui', 'ilaccountregistrationgui');
$skipFiles = array('pwassist.php');
if(in_array(strtolower($_REQUEST['cmdClass']), $skipClasses))
{
return;
}
else
{
$script = pathinfo($_SERVER['PHP_SELF'], PATHINFO_BASENAME);
if(in_array(strtolower($script), $skipFiles))
return;
}
if(
!$this->apache_settings->get('apache_auth_authenticate_on_login_page') &&
(
preg_match('/.*login\.php$/', $_SERVER['SCRIPT_NAME']) ||
((in_array($_REQUEST['cmd'], array('showLogin', 'showTermsOfService')) || isset($_POST['change_lang_to'])) && strtolower($_REQUEST['cmdClass']) == 'ilstartupgui')
)
)
{
return;
}
if(!$this->apache_settings->get('apache_auth_authenticate_on_login_page') && preg_match('/.*login\.php$/', $_SERVER['SCRIPT_NAME']))
{
return;
}
if (ilContext::supportsRedirects() && !isset($_GET['passed_sso']) && (!defined('IL_CERT_SSO') || IL_CERT_SSO == false)) {
// redirect to sso
// this part is executed in default ilias context...
$path = $_SERVER['REQUEST_URI'];
if ($path{0} == '/') {
$path = substr($path, 1);
}
if (substr($path, 0, 4) != 'http') {
$parts = parse_url(ILIAS_HTTP_PATH);
$path = $parts['scheme'] . '://' . $parts['host'] . '/' . $path;
}
$path = urlencode($path);
ilUtil::redirect(ilUtil::getHtmlPath('/sso/index.php?force_mode_apache=1&r=' . $path . '&cookie_path='.IL_COOKIE_PATH . '&ilias_path=' . ILIAS_HTTP_PATH));
}
else {
return parent::login();
}
}

+ Here is the call graph for this function:

ilAuthApache::supportsRedirects ( )

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

Returns

Reimplemented from ilAuthBase.

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

{
return true;
}

Field Documentation

ilAuthApache::$apache_settings
private

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


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