ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilAuthProviderDatabase.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once './Services/Authentication/classes/Provider/class.ilAuthProvider.php';
6include_once './Services/Authentication/interfaces/interface.ilAuthProviderInterface.php';
7
15{
16
17
23 {
24 include_once './Services/User/classes/class.ilUserPasswordManager.php';
25
30
31 $this->getLogger()->debug('Trying to authenticate user: '. $this->getCredentials()->getUsername());
32 if($user instanceof ilObjUser)
33 {
34 if(!ilAuthUtils::isLocalPasswordEnabledForAuthMode($user->getAuthMode(true)))
35 {
36 $this->getLogger()->debug('DB authentication failed: current user auth mode does not allow local validation.');
37 $this->getLogger()->debug('User auth mode: ' . $user->getAuthMode(true));
38 $this->handleAuthenticationFail($status, 'err_wrong_login');
39 return false;
40 }
41 if(ilUserPasswordManager::getInstance()->verifyPassword($user, $this->getCredentials()->getPassword()))
42 {
43 $this->getLogger()->debug('Successfully authenticated user: ' . $this->getCredentials()->getUsername());
45 $status->setAuthenticatedUserId($user->getId());
46 return true;
47
48 }
49 }
50 $this->handleAuthenticationFail($status, 'err_wrong_login');
51 return false;
52 }
53}
54?>
An exception for terminatinating execution or to throw for unit testing.
Description of class class.
Base class for authentication providers (radius, ldap, apache, ...)
getLogger()
Get logger.
handleAuthenticationFail(ilAuthStatus $status, $a_reason)
Handle failed authentication.
Auth status implementation.
static isLocalPasswordEnabledForAuthMode($a_authmode)
Check if local password validation is enabled for a specific auth_mode.
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstance()
Single method to reduce footprint (included files, created instances)
Standard interface for auth provider implementations.
doAuthentication(\ilAuthStatus $status)
Do authentication.