ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAuthContainerMDB2 Class Reference

Storage driver for fetching login data from a database. More...

+ Inheritance diagram for ilAuthContainerMDB2:
+ Collaboration diagram for ilAuthContainerMDB2:

Public Member Functions

 ilAuthContainerMDB2 ($dsn)
 getUser ($username)
 fetchData ($username, $password, $isChallengeResponse=false)
 setObserversEnabled ($boolean)
 Enables/disables the observers of this container.
 isObserversEnabled ()
 Returns true, if the observers of this container are enabled.
 loginObserver ($a_username)
 Called from Auth after successful login.
 failedLoginObserver ()
 Called from Auth after failed login.

Static Public Member Functions

static toUsernameWithoutDomain ($username)
 Static function removes Microsoft domain name from username.

Private Attributes

 $isObserversEnabled

Detailed Description

Storage driver for fetching login data from a database.

This driver strips leading Microsoft Windows domain names from the user name.

For example: hsw hsw/wrandels and wrandels refer all to the login name wrandels.

This storage driver can use all databases which are supported by the PEAR DB abstraction layer to fetch login data.

Usage note: If you use an ilAuthContainerMDB2 object as the container for an Auth object you MUST call setEnableObservers(true) on the ilAuthContainerMDB2 object. The observers are used to perform actions depending on the success or failure of a login attempt.

Author
Werner Randelshofer, Lucerne University of Applied Sciences and Arts, werne.nosp@m.r.ra.nosp@m.ndels.nosp@m.hofe.nosp@m.r@hsl.nosp@m.u.ch
Version
$Id$

Definition at line 25 of file class.ilAuthContainerMDB2.php.

Member Function Documentation

ilAuthContainerMDB2::failedLoginObserver ( )

Called from Auth after failed login.

Parameters
stringusername

Definition at line 124 of file class.ilAuthContainerMDB2.php.

References $ilLog.

Referenced by fetchData().

{
global $ilLog;
$ilLog->write(__METHOD__.': login failed'.
', remote:'.$_SERVER['REMOTE_ADDR'].':'.$_SERVER['REMOTE_PORT'].
', server:'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT']
);
}

+ Here is the caller graph for this function:

ilAuthContainerMDB2::fetchData (   $username,
  $password,
  $isChallengeResponse = false 
)

Definition at line 49 of file class.ilAuthContainerMDB2.php.

References failedLoginObserver(), isObserversEnabled(), loginObserver(), and toUsernameWithoutDomain().

{
$isSuccessful = parent::fetchData($username, $password, $isChallengeResponse);
if ($this->isObserversEnabled)
{
if ($isSuccessful)
{
$this->loginObserver($username);
}
else
{
}
}
return $isSuccessful;
}

+ Here is the call graph for this function:

ilAuthContainerMDB2::getUser (   $username)

Definition at line 41 of file class.ilAuthContainerMDB2.php.

References toUsernameWithoutDomain().

{
// Fetch the data
return parent::getUser($username);
}

+ Here is the call graph for this function:

ilAuthContainerMDB2::ilAuthContainerMDB2 (   $dsn)

Definition at line 36 of file class.ilAuthContainerMDB2.php.

{
$this->Auth_Container_MDB2($dsn);
}
ilAuthContainerMDB2::isObserversEnabled ( )

Returns true, if the observers of this container are enabled.

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

References $isObserversEnabled.

Referenced by fetchData(), and setObserversEnabled().

+ Here is the caller graph for this function:

ilAuthContainerMDB2::loginObserver (   $a_username)

Called from Auth after successful login.

Parameters
stringusername

Definition at line 110 of file class.ilAuthContainerMDB2.php.

References $ilLog.

Referenced by fetchData().

{
global $ilLog;
$ilLog->write(__METHOD__.': logged in as '.$a_username.
', remote:'.$_SERVER['REMOTE_ADDR'].':'.$_SERVER['REMOTE_PORT'].
', server:'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT']
);
}

+ Here is the caller graph for this function:

ilAuthContainerMDB2::setObserversEnabled (   $boolean)

Enables/disables the observers of this container.

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

References isObserversEnabled().

{
$this->isObserversEnabled = $boolean;
}

+ Here is the call graph for this function:

static ilAuthContainerMDB2::toUsernameWithoutDomain (   $username)
static

Static function removes Microsoft domain name from username.

Definition at line 71 of file class.ilAuthContainerMDB2.php.

Referenced by fetchData(), ilObjUser\getLoginFromAuth(), and getUser().

{
// Remove all characters including the last slash or the last backslash
// in the username
$pos = strrpos($username, '/');
$pos2 = strrpos($username, '\\');
if ($pos === false || $pos < $pos2)
{
$pos = $pos2;
}
if ($pos !== false)
{
$username = substr($username, $pos + 1);
}
return $username;
}

+ Here is the caller graph for this function:

Field Documentation

ilAuthContainerMDB2::$isObserversEnabled
private

Definition at line 34 of file class.ilAuthContainerMDB2.php.

Referenced by isObserversEnabled().


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