[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/Auth/ -> auto.php (source)

   1  <?php
   2  /**
   3   * The Auth_auto class transparently logs users in to Horde using ONE
   4   * username, either defined in the config or defaulting to
   5   * 'horde_user'. This is only for use in testing or behind a firewall;
   6   * it should NOT be used on a public, production machine.
   7   *
   8   * Optional parameters:<pre>
   9   *   'username'     The username to authenticate everyone as.
  10   *                  DEFAULT: 'horde_user'
  11   *   'password'     The password to record in the user's credentials.
  12   *                  DEFAULT: none
  13   *   'requestuser'  If true, allow username to be passed by GET, POST or
  14   *                  cookie.</pre>
  15   *
  16   *
  17   * $Horde: framework/Auth/Auth/auto.php,v 1.12.4.8 2006/01/01 21:28:07 jan Exp $
  18   *
  19   * Copyright 1999-2006 Chuck Hagenbuch <chuck@horde.org>
  20   *
  21   * See the enclosed file COPYING for license information (LGPL). If you
  22   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  23   *
  24   * @author  Chuck Hagenbuch <chuck@horde.org>
  25   * @since   Horde 2.2
  26   * @package Horde_Auth
  27   */
  28  class Auth_auto extends Auth {
  29  
  30      /**
  31       * An array of capabilities, so that the driver can report which
  32       * operations it supports and which it doesn't.
  33       *
  34       * @var array
  35       */
  36      var $capabilities = array('add'           => false,
  37                                'update'        => false,
  38                                'resetpassword' => false,
  39                                'remove'        => false,
  40                                'list'          => false,
  41                                'transparent'   => true);
  42  
  43      /**
  44       * Constructs a new Automatic authentication object.
  45       *
  46       * @param array $params  A hash containing parameters.
  47       */
  48      function Auth_auto($params = array())
  49      {
  50          $this->_setParams($params);
  51      }
  52  
  53      /**
  54       * Set parameters for the Auth_auto object.
  55       *
  56       * @access private
  57       *
  58       * @param array $params  Parameters. None currently required;
  59       *                       'username', 'password', and 'requestuser' are optional.
  60       */
  61      function _setParams($params)
  62      {
  63          if (!isset($params['username'])) {
  64              $params['username'] = 'horde_user';
  65          }
  66          $this->_params = $params;
  67      }
  68  
  69      /**
  70       * Automatic authentication: Set the user allowed IP block.
  71       *
  72       * @return boolean  Whether or not the client is allowed.
  73       */
  74      function transparent()
  75      {
  76          $username = (!empty($this->_params['requestuser']) && isset($_REQUEST['username'])) ?
  77              $_REQUEST['username'] :
  78              $this->_params['username'];
  79          $this->setAuth($username,
  80                         array('transparent' => 1,
  81                               'password' => isset($this->_params['password']) ? $this->_params['password'] : null));
  82          return true;
  83      }
  84  
  85  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7