ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAuthContainerMDB2 Class Reference

Authentication against ILIAS database. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 fetchData ($username, $password, $isChallengeResponse=false)
 Check for local password in case of auth modes, which allow local authentication. More...
 
 supportsCaptchaVerification ()
 
- Public Member Functions inherited from Auth_Container_MDB2
 Auth_Container_MDB2 ($dsn)
 Constructor of the container class. More...
 
 _connect ($dsn)
 Connect to database by using the given DSN string. More...
 
 _prepare ()
 Prepare database connection. More...
 
 query ($query)
 Prepare query to the database. More...
 
 _setDefaults ()
 Set some default options. More...
 
 _parseOptions ($array)
 Parse options passed to the container class. More...
 
 _quoteDBFields ()
 Quote the db_fields option to avoid the possibility of SQL injection. More...
 
 fetchData ($username, $password, $isChallengeResponse=false)
 Get user information from database. More...
 
 listUsers ()
 Returns a list of users from the container. More...
 
 addUser ($username, $password, $additional="")
 Add user to the storage container. More...
 
 removeUser ($username)
 Remove user from the storage container. More...
 
 changePassword ($username, $password)
 Change password for user in the storage container. More...
 
 supportsChallengeResponse ()
 Determine if this container supports password authentication with challenge response. More...
 
 getCryptType ()
 Returns the selected crypt type for this container. More...
 
- Public Member Functions inherited from Auth_Container
 Auth_Container ()
 Constructor. More...
 
 fetchData ($username, $password, $isChallengeResponse=false)
 Fetch data from storage container. More...
 
 verifyPassword ($password1, $password2, $cryptType="md5")
 Crypt and verfiy the entered password. More...
 
 supportsChallengeResponse ()
 Returns true if the container supports Challenge Response password authentication. More...
 
 getCryptType ()
 Returns the crypt current crypt type of the container. More...
 
 listUsers ()
 List all users that are available from the storage container. More...
 
 getUser ($username)
 Returns a user assoc array. More...
 
 addUser ($username, $password, $additional=null)
 Add a new user to the storage container. More...
 
 removeUser ($username)
 Remove user from the storage container. More...
 
 changePassword ($username, $password)
 Change password for user in the storage container. More...
 
 log ($message, $level=AUTH_LOG_DEBUG)
 Log a message to the Auth log. More...
 
- Public Member Functions inherited from ilAuthContainerBase
 loginObserver ($a_username, $a_auth)
 Called after successful login. More...
 
 failedLoginObserver ($a_username, $a_auth)
 Called after failed login. More...
 
 checkAuthObserver ($a_username, $a_auth)
 Called after check auth requests. More...
 
 logoutObserver ($a_username, $a_auth)
 Called after logout. More...
 
 supportsCaptchaVerification ()
 Returns whether or not the auth container supports the verification of captchas This should be true for those auth methods, which are available in the default login form. More...
 

Static Public Member Functions

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

Additional Inherited Members

- Data Fields inherited from Auth_Container_MDB2
 $options = array()
 
 $db = null
 
 $dsn = ''
 
 $activeUser = ''
 
- Data Fields inherited from Auth_Container
 $activeUser = ""
 User that is currently selected from the storage container. More...
 
 $_auth_obj = null
 The Auth object this container is attached to. More...
 

Detailed Description

Authentication against ILIAS database.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilAuthContainerMDB2::__construct ( )

Constructor.

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

42 {
43 global $ilClientIniFile, $ilDB, $ilIliasIniFile;
44
45 $options['dsn'] = $ilDB->getDSN();
46 $options['table'] = $ilClientIniFile->readVariable('auth', 'table');
47 $options['usernamecol'] = $ilClientIniFile->readVariable('auth', 'usercol');
48 $options['passwordcol'] = $ilClientIniFile->readVariable('auth', 'passcol');
49
50 // studip mode: check against submitted md5 password for ilSoapUserAdministration::login()
51 // todo: check whether we should put this to another place
52 include_once "Services/Context/classes/class.ilContext.php";
54 if (isset($_POST['password']) && (preg_match('/^[a-f0-9]{32,32}$/i', $_POST['password']) || preg_match('/\$2[aby]\$\d{2}\$.{53}/i', $_POST['password'])))
55 {
56 if ($ilIliasIniFile->readVariable('server', 'studip'))
57 {
58 $options['cryptType'] = 'none';
59 }
60 }
61 }
62
63 parent::__construct($options);
64 }
static getType()
Get context type.
const CONTEXT_SOAP
$_POST['username']
Definition: cron.php:12
global $ilDB
global $ilIliasIniFile

References $_POST, $ilDB, $ilIliasIniFile, Auth_Container_MDB2\$options, ilContext\CONTEXT_SOAP, and ilContext\getType().

+ Here is the call graph for this function:

Member Function Documentation

◆ fetchData()

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

Check for local password in case of auth modes, which allow local authentication.

Parameters
type$username
type$password
type$isChallengeResponse

Reimplemented from Auth_Container_MDB2.

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

94 {
95 $usr_id = ilObjUser::_lookupId($username);
96 $auth_mode = ilObjUser::_lookupAuthMode($usr_id);
97 $auth_id = ilAuthUtils::_getAuthMode($auth_mode);
98
99 ilLoggerFactory::getLogger('auth')->debug('Current auth id of user: ' . $auth_id);
100
101 $local_passwords_allowed = false;
102 switch($auth_id)
103 {
104 case AUTH_APACHE:
105 case AUTH_LOCAL:
106 $local_passwords_allowed = true;
107
108 default:
110 {
111 $local_passwords_allowed = true;
112 }
113 }
114 if($local_passwords_allowed)
115 {
116 return parent::fetchData($username, $password, $isChallengeResponse);
117 }
118
119 ilLoggerFactory::getLogger('auth')->debug('No local password authentication allowed');
120 return false;
121 }
const AUTH_APACHE
const AUTH_LOCAL
_getAuthMode($a_auth_mode, $a_db_handler='')
static isPasswordModificationEnabled($a_authmode)
Check if password modification is enabled.
static getLogger($a_component_id)
Get component logger.
static _lookupId($a_user_str)
Lookup id by login.
static _lookupAuthMode($a_usr_id)
lookup auth mode

References ilAuthUtils\_getAuthMode(), ilObjUser\_lookupAuthMode(), ilObjUser\_lookupId(), AUTH_APACHE, AUTH_LOCAL, ilLoggerFactory\getLogger(), and ilAuthUtils\isPasswordModificationEnabled().

+ Here is the call graph for this function:

◆ supportsCaptchaVerification()

ilAuthContainerMDB2::supportsCaptchaVerification ( )
Returns
bool

Reimplemented from ilAuthContainerBase.

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

127 {
128 return true;
129 }

◆ toUsernameWithoutDomain()

static ilAuthContainerMDB2::toUsernameWithoutDomain (   $username)
static

Static function removes Microsoft domain name from username.

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

71 {
72 // Remove all characters including the last slash or the last backslash
73 // in the username
74 $pos = strrpos($username, '/');
75 $pos2 = strrpos($username, '\\');
76 if ($pos === false || $pos < $pos2)
77 {
78 $pos = $pos2;
79 }
80 if ($pos !== false)
81 {
82 $username = substr($username, $pos + 1);
83 }
84 return $username;
85 }

Referenced by ilObjUser\getLoginFromAuth().

+ Here is the caller graph for this function:

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