Overview

Packages

  • Auth

Classes

  • Horde_Auth
  • Horde_Auth_Auto
  • Horde_Auth_Base
  • Horde_Auth_Composite
  • Horde_Auth_Customsql
  • Horde_Auth_Cyrsql
  • Horde_Auth_Exception
  • Horde_Auth_Ftp
  • Horde_Auth_Http
  • Horde_Auth_Http_Remote
  • Horde_Auth_Imap
  • Horde_Auth_Ipbasic
  • Horde_Auth_Kolab
  • Horde_Auth_Ldap
  • Horde_Auth_Login
  • Horde_Auth_Msad
  • Horde_Auth_Pam
  • Horde_Auth_Passwd
  • Horde_Auth_Peclsasl
  • Horde_Auth_Radius
  • Horde_Auth_Shibboleth
  • Horde_Auth_Smb
  • Horde_Auth_Smbclient
  • Horde_Auth_Sql
  • Horde_Auth_Translation
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * The Horde_Auth_Kolab implementation of the Horde authentication system.
 4:  * Derives from the Horde_Auth_Imap authentication object, and provides
 5:  * parameters to it based on the global Kolab configuration.
 6:  *
 7:  * Copyright 2004-2007 Stuart Binge <s.binge@codefusion.co.za>
 8:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 9:  *
10:  * See the enclosed file COPYING for license information (LGPL). If you did
11:  * not receive this file, http://www.horde.org/licenses/lgpl21
12:  *
13:  * @author   Stuart Binge <s.binge@codefusion.co.za>
14:  * @author   Gunnar Wrobel <wrobel@pardus.de>
15:  * @category Horde
16:  * @package  Auth
17:  */
18: class Horde_Auth_Kolab extends Horde_Auth_Base
19: {
20:     /**
21:      * An array of capabilities, so that the driver can report which
22:      * operations it supports and which it doesn't.
23:      *
24:      * @var array
25:      */
26:     protected $_capabilities = array(
27:         'authenticate'  => true
28:     );
29: 
30:     /**
31:      * Constructor.
32:      *
33:      * @params array $params  Parameters:
34:      * <pre>
35:      * 'kolab' - (Horde_Kolab_Session) [REQUIRED] TODO
36:      * </pre>
37:      *
38:      * @throws InvalidArgumentException
39:      */
40:     public function __construct(array $params = array())
41:     {
42:         if (!isset($params['kolab'])) {
43:             throw new InvalidArgumentException('Missing kolab parameter.');
44:         }
45: 
46:         parent::__construct($params);
47:     }
48: 
49:     /**
50:      * Find out if a set of login credentials are valid.
51:      *
52:      * For Kolab this requires to identify the IMAP server the user should
53:      * be authenticated against before the credentials can be checked using
54:      * this server. The Kolab_Server module handles identification of the
55:      * correct IMAP server.
56:      *
57:      * @param string $userId      The userId to check.
58:      * @param array $credentials  An array of login credentials. For Kolab,
59:      *                            this must contain a "password" entry.
60:      *
61:      * @throws Horde_Auth_Exception
62:      */
63:     protected function _authenticate($userId, $credentials)
64:     {
65:         try {
66:             $this->_params['kolab']->connect($userId, $credentials);
67:         } catch (Horde_Kolab_Session_Exception_Badlogin $e) {
68:             throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
69:         } catch (Horde_Kolab_Session_Exception $e) {
70:             if ($this->_logger) {
71:                 $this->_logger->log($e, 'ERR');
72:             }
73:             throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
74:         }
75: 
76:         $this->_credentials['userId'] = $this->_params['kolab']->getMail();
77: 
78:         return true;
79:     }
80: 
81: }
82: 
API documentation generated by ApiGen