[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * The Auth_imsp class provides basic authentication against an IMSP server. 4 * This will be most benificial if already using an IMSP based preference 5 * system or IMSP based addressbook system 6 * 7 * $Horde: framework/Auth/Auth/imsp.php,v 1.2.10.10 2006/01/01 21:28:07 jan Exp $ 8 * 9 * Copyright 2004-2006 Michael Rubinsky <mrubinsk@horde.org> 10 * 11 * See the enclosed file COPYING for license information (LGPL). If you 12 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 13 * 14 * @author Michael Rubinsky <mrubinsk@horde.org> 15 * @package Horde_Auth 16 */ 17 class Auth_imsp extends Auth{ 18 19 /** 20 * An array of capabilities, so that the driver can report which 21 * operations it supports and which it doesn't. 22 * 23 * @var array 24 */ 25 var $capabilities = array('add' => false, 26 'update' => false, 27 'resetpassword' => false, 28 'remove' => false, 29 'list' => false, 30 'transparent' => false); 31 /** 32 * Constructor function. Creates new Auth_imsp object. 33 * 34 * @param array $params A hash containing parameters. 35 */ 36 function Auth_imsp($params = array()) 37 { 38 $this->_setParams($params); 39 } 40 41 /** 42 * Private authentication function. 43 * 44 * @access private 45 * 46 * @param string $userID Username for IMSP server. 47 * @param array $credentials Hash containing 'password' element. 48 * 49 * @return boolean True on success / False on failure. 50 */ 51 function _authenticate($userID, $credentials) 52 { 53 require_once 'Net/IMSP/Auth.php'; 54 55 $this->_params['username'] = $userID; 56 $this->_params['password'] = $credentials['password']; 57 $imsp = &Net_IMSP_Auth::singleton($this->_params['auth_method']); 58 59 if (is_a($imsp, 'PEAR_Error')) { 60 return $imsp; 61 } 62 63 $result = $imsp->authenticate($this->_params, false); 64 if (is_a($result, 'PEAR_Error')) { 65 $this->_setAuthError(AUTH_REASON_BADLOGIN); 66 return false; 67 } else { 68 return true; 69 } 70 } 71 72 /** 73 * Checks the params array and sets default values. 74 * 75 * @access private 76 * @param array $params Hash containing IMSP parameters. 77 */ 78 function _setParams($params) 79 { 80 $this->_params['server'] = $params['server']; 81 $this->_params['port'] = $params['port']; 82 $this->_params['auth_method'] = $params['auth_method']; 83 84 if (isset($params['auth_mechanism'])) { 85 $this->_params['auth_mechanism'] = $params['auth_mechanism']; 86 $this->_params['socket'] = $params['socket']; 87 $this->_params['command'] = $params['command']; 88 } 89 } 90 91 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |