ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
Auth_Container_Multiple Class Reference
+ Inheritance diagram for Auth_Container_Multiple:
+ Collaboration diagram for Auth_Container_Multiple:

Public Member Functions

 Auth_Container_Multiple ($options)
 Constructor for Array Container. More...
 
 fetchData ($user, $pass)
 Get user information from array. 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...
 

Data Fields

 $options = array()
 The options for each container. More...
 
 $containers = array()
 The instanciated containers. More...
 
- 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

Definition at line 80 of file Multiple.php.

Member Function Documentation

◆ Auth_Container_Multiple()

Auth_Container_Multiple::Auth_Container_Multiple (   $options)

Constructor for Array Container.

Parameters
array$dataOptions for the container
Returns
void

Definition at line 107 of file Multiple.php.

References $options, and PEAR\raiseError().

108  {
109  if (!is_array($options)) {
110  PEAR::raiseError('The options for Auth_Container_Multiple must be an array');
111  }
112  if (count($options) < 1) {
113  PEAR::raiseError('You must define at least one sub container to use in Auth_Container_Multiple');
114  }
115  foreach ($options as $option) {
116  if (!isset($option['type'])) {
117  PEAR::raiseError('No type defined for sub container');
118  }
119  }
120  $this->options = $options;
121  }
$options
The options for each container.
Definition: Multiple.php:89
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object&#39;s de...
Definition: PEAR.php:524
+ Here is the call graph for this function:

◆ fetchData()

Auth_Container_Multiple::fetchData (   $user,
  $pass 
)

Get user information from array.

This function uses the given username to fetch the corresponding login data from the array. If an account that matches the passed username and password is found, the function returns true. Otherwise it returns false.

Parameters
stringUsername
stringPassword
Returns
boolean|PEAR_Error Error object or boolean

Definition at line 138 of file Multiple.php.

References Auth_Container\$_auth_obj, $pass, $result, AUTH_LOG_DEBUG, PEAR\isError(), and Auth_Container\log().

139  {
140  $this->log('Auth_Container_Multiple::fetchData() called.', AUTH_LOG_DEBUG);
141 
142  foreach ($this->options as $key => $options) {
143 
144  $this->log('Using Container '.$key.' of type '.$options['type'].'.', AUTH_LOG_DEBUG);
145 
146  if (isset($this->containers[$key]) && is_a($this->containers[$key], 'Auth_Container')) {
147 
148  $container = &$this->containers[$key];
149 
150  } else {
151 
152  $this->containers[$key] = &$this->_auth_obj->_factory($options['type'], $options['options']);
153  $this->containers[$key]->_auth_obj = &$this->_auth_obj;
154  $container = &$this->containers[$key];
155 
156  }
157 
158  $result = $container->fetchData($user, $pass);
159 
160  if (PEAR::isError($result)) {
161 
162  $this->log('Container '.$key.': '.$result->getMessage(), AUTH_LOG_ERR);
163  return $result;
164 
165  } elseif ($result == true) {
166 
167  $this->log('Container '.$key.': Authentication successful.', AUTH_LOG_DEBUG);
168  return true;
169 
170  } else {
171 
172  $this->log('Container '.$key.': Authentication failed.', AUTH_LOG_DEBUG);
173 
174  }
175 
176  }
177 
178  $this->log('Auth_Container_Multiple: All containers rejected user credentials.', AUTH_LOG_DEBUG);
179 
180  return false;
181 
182  }
$result
const AUTH_LOG_DEBUG
Auth Log level - DEBUG.
Definition: Auth.php:59
$options
The options for each container.
Definition: Multiple.php:89
log($message, $level=AUTH_LOG_DEBUG)
Log a message to the Auth log.
Definition: Container.php:246
$_auth_obj
The Auth object this container is attached to.
Definition: Container.php:56
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
+ Here is the call graph for this function:

Field Documentation

◆ $containers

array Auth_Container_Multiple::$containers = array()

The instanciated containers.

Definition at line 96 of file Multiple.php.

◆ $options

array Auth_Container_Multiple::$options = array()

The options for each container.

Definition at line 89 of file Multiple.php.

Referenced by Auth_Container_Multiple().


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