ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 _setDefaults ()
 Set some default options.
 _checkServer ()
 Check if the given server and port are reachable.
 _parseOptions ($array)
 Parse options passed to the container class.
 fetchData ($username, $password)
 Try to open a IMAP stream using $username / $password.
- Public Member Functions inherited from Auth_Container
 Auth_Container ()
 Constructor.
 fetchData ($username, $password, $isChallengeResponse=false)
 Fetch data from storage container.
 verifyPassword ($password1, $password2, $cryptType="md5")
 Crypt and verfiy the entered password.
 supportsChallengeResponse ()
 Returns true if the container supports Challenge Response password authentication.
 getCryptType ()
 Returns the crypt current crypt type of the container.
 listUsers ()
 List all users that are available from the storage container.
 getUser ($username)
 Returns a user assoc array.
 addUser ($username, $password, $additional=null)
 Add a new user to the storage container.
 removeUser ($username)
 Remove user from the storage container.
 changePassword ($username, $password)
 Change password for user in the storage container.
 log ($message, $level=AUTH_LOG_DEBUG)
 Log a message to the Auth log.
- Public Member Functions inherited from ilAuthContainerBase
 loginObserver ($a_username, $a_auth)
 Called after successful login.
 failedLoginObserver ($a_username, $a_auth)
 Called after failed login.
 checkAuthObserver ($a_username, $a_auth)
 Called after check auth requests.
 logoutObserver ($a_username, $a_auth)
 Called after logout.

Data Fields

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

Detailed Description

Definition at line 84 of file IMAP.php.

Member Function Documentation

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().

{
$this->log('Auth_Container_IMAP::_checkServer() called.', AUTH_LOG_DEBUG);
$fp = @fsockopen ($this->options['host'], $this->options['port'],
$errno, $errstr, $this->options['timeout']);
if (is_resource($fp)) {
@fclose($fp);
} else {
$message = "Error connecting to IMAP server "
. $this->options['host']
. ":" . $this->options['port'];
return PEAR::raiseError($message, 41);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
foreach ($array as $key => $value) {
$this->options[$key] = $value;
}
}

+ Here is the caller graph for this function:

Auth_Container_IMAP::_setDefaults ( )

Set some default options.

private

Definition at line 133 of file IMAP.php.

Referenced by Auth_Container_IMAP().

{
$this->options['host'] = 'localhost';
$this->options['port'] = 143;
$this->options['baseDSN'] = '';
$this->options['checkServer'] = true;
$this->options['timeout'] = 20;
}

+ Here is the caller graph for this function:

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 _checkServer(), _parseOptions(), _setDefaults(), PEAR_ERROR_DIE, and PEAR\raiseError().

{
if (!extension_loaded('imap')) {
return PEAR::raiseError('Cannot use IMAP authentication, '
.'IMAP extension not loaded!', 41, PEAR_ERROR_DIE);
}
$this->_setDefaults();
// set parameters (if any)
if (is_array($params)) {
$this->_parseOptions($params);
}
if ($this->options['checkServer']) {
$this->_checkServer($this->options['timeout']);
}
return true;
}

+ Here is the call graph for this function:

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().

{
$this->log('Auth_Container_IMAP::fetchData() called.', AUTH_LOG_DEBUG);
$dsn = '{'.$this->options['host'].':'.$this->options['port'].$this->options['baseDSN'].'}';
$conn = @imap_open ($dsn, $username, $password, OP_HALFOPEN);
if (is_resource($conn)) {
$this->log('Successfully connected to IMAP server.', AUTH_LOG_DEBUG);
$this->activeUser = $username;
@imap_close($conn);
return true;
} else {
$this->log('Connection to IMAP server failed.', AUTH_LOG_DEBUG);
$this->activeUser = '';
return false;
}
}

+ Here is the call graph for this function:

Field Documentation

Auth_Container_IMAP::$options = array()

Definition at line 93 of file IMAP.php.


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