ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
Auth_Container_IMAP Class Reference
+ Inheritance diagram for Auth_Container_IMAP:
+ Collaboration diagram for Auth_Container_IMAP:

Public Member Functions

 Auth_Container_IMAP ($params)
 Constructor of the container class. More...
 
 _setDefaults ()
 Set some default options. More...
 
 _checkServer ()
 Check if the given server and port are reachable. More...
 
 _parseOptions ($array)
 Parse options passed to the container class. More...
 
 fetchData ($username, $password)
 Try to open a IMAP stream using $username / $password. 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()
 
- 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 84 of file IMAP.php.

Member Function Documentation

◆ _checkServer()

Auth_Container_IMAP::_checkServer ( )

Check if the given server and port are reachable.

private

Definition at line 150 of file IMAP.php.

References AUTH_LOG_DEBUG, Auth_Container\log(), and PEAR\raiseError().

Referenced by Auth_Container_IMAP().

150  {
151  $this->log('Auth_Container_IMAP::_checkServer() called.', AUTH_LOG_DEBUG);
152  $fp = @fsockopen ($this->options['host'], $this->options['port'],
153  $errno, $errstr, $this->options['timeout']);
154  if (is_resource($fp)) {
155  @fclose($fp);
156  } else {
157  $message = "Error connecting to IMAP server "
158  . $this->options['host']
159  . ":" . $this->options['port'];
160  return PEAR::raiseError($message, 41);
161  }
162  }
const AUTH_LOG_DEBUG
Auth Log level - DEBUG.
Definition: Auth.php:59
& 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's de...
Definition: PEAR.php:524
log($message, $level=AUTH_LOG_DEBUG)
Log a message to the Auth log.
Definition: Container.php:246
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _parseOptions()

Auth_Container_IMAP::_parseOptions (   $array)

Parse options passed to the container class.

private

Parameters
array

Definition at line 173 of file IMAP.php.

Referenced by Auth_Container_IMAP().

174  {
175  foreach ($array as $key => $value) {
176  $this->options[$key] = $value;
177  }
178  }
+ Here is the caller graph for this function:

◆ _setDefaults()

Auth_Container_IMAP::_setDefaults ( )

Set some default options.

private

Definition at line 133 of file IMAP.php.

Referenced by Auth_Container_IMAP().

134  {
135  $this->options['host'] = 'localhost';
136  $this->options['port'] = 143;
137  $this->options['baseDSN'] = '';
138  $this->options['checkServer'] = true;
139  $this->options['timeout'] = 20;
140  }
+ Here is the caller graph for this function:

◆ Auth_Container_IMAP()

Auth_Container_IMAP::Auth_Container_IMAP (   $params)

Constructor of the container class.

Parameters
$paramsassociative array with host, port, baseDSN, checkServer and userattr key
Returns
object Returns an error object if something went wrong
Todo:
Use PEAR Net_IMAP if IMAP extension not loaded

Definition at line 106 of file IMAP.php.

References $params, _checkServer(), _parseOptions(), _setDefaults(), PEAR_ERROR_DIE, and PEAR\raiseError().

107  {
108  if (!extension_loaded('imap')) {
109  return PEAR::raiseError('Cannot use IMAP authentication, '
110  .'IMAP extension not loaded!', 41, PEAR_ERROR_DIE);
111  }
112  $this->_setDefaults();
113 
114  // set parameters (if any)
115  if (is_array($params)) {
116  $this->_parseOptions($params);
117  }
118 
119  if ($this->options['checkServer']) {
120  $this->_checkServer($this->options['timeout']);
121  }
122  return true;
123  }
_parseOptions($array)
Parse options passed to the container class.
Definition: IMAP.php:173
const PEAR_ERROR_DIE
Definition: PEAR.php:34
_checkServer()
Check if the given server and port are reachable.
Definition: IMAP.php:150
& 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's de...
Definition: PEAR.php:524
$params
Definition: example_049.php:96
_setDefaults()
Set some default options.
Definition: IMAP.php:133
+ Here is the call graph for this function:

◆ fetchData()

Auth_Container_IMAP::fetchData (   $username,
  $password 
)

Try to open a IMAP stream using $username / $password.

Parameters
stringUsername
stringPassword
Returns
boolean

Definition at line 190 of file IMAP.php.

References AUTH_LOG_DEBUG, and Auth_Container\log().

191  {
192  $this->log('Auth_Container_IMAP::fetchData() called.', AUTH_LOG_DEBUG);
193  $dsn = '{'.$this->options['host'].':'.$this->options['port'].$this->options['baseDSN'].'}';
194  $conn = @imap_open ($dsn, $username, $password, OP_HALFOPEN);
195  if (is_resource($conn)) {
196  $this->log('Successfully connected to IMAP server.', AUTH_LOG_DEBUG);
197  $this->activeUser = $username;
198  @imap_close($conn);
199  return true;
200  } else {
201  $this->log('Connection to IMAP server failed.', AUTH_LOG_DEBUG);
202  $this->activeUser = '';
203  return false;
204  }
205  }
const AUTH_LOG_DEBUG
Auth Log level - DEBUG.
Definition: Auth.php:59
log($message, $level=AUTH_LOG_DEBUG)
Log a message to the Auth log.
Definition: Container.php:246
+ Here is the call graph for this function:

Field Documentation

◆ $options

Auth_Container_IMAP::$options = array()

Definition at line 93 of file IMAP.php.


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