Quite possibly the largest commit in PICKLES history, shy of perhaps the initial revision. Bunches of restructuring and refactoring and all that.

git-svn-id: http://svn.cleancode.org/svn/pickles@61 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
Josh Sherman 2008-10-09 05:12:31 +00:00
parent fcf1ffde4e
commit e9f8b555d3
662 changed files with 37556 additions and 14651 deletions

View file

@ -1,32 +1,54 @@
<?php
/**
* Security class
* Security Class File for PICKLES
*
* PICKLES is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* PICKLES is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with PICKLES. If not, see
* <http://www.gnu.org/licenses/>.
*
* @author Joshua John Sherman <josh@phpwithpickles.org>
* @copyright Copyright 2007, 2008 Joshua John Sherman
* @link http://phpwithpickles.org
* @license http://www.gnu.org/copyleft/lesser.html
* @package PICKLES
*/
/**
* Security Class
*
* Handles authenticating a user via an Apache login box.
*
* @package PICKLES
* @author Joshua Sherman <josh@phpwithpickles.org>
* @copyright 2007-2008 Joshua Sherman
* @todo Make the SQL less specific, right now you have to use a table
* named users, and use the email as the username. I will need to
* move this to the configuration and allow the user to specify which
* table to authenticate against, and what column names to use for the
* username and password.
* @todo Make the SQL less specific, right now you have to use a table
* named users, and use the email as the username. I will need
* to move this to the configuration and allow the user to
* specify which table to authenticate against, and what column
* names to use for the username and password.
*/
class Security extends Object {
/**
* Authenticates the user
*
* Checks for the authentication variables to be passed in the $_SERVER super
* global and attempts to authenticate the user against MySQL. If the user
* cannot successfully they will be presented with a 401 Unauthorized page.
* Checks for the authentication variables to be passed in the $_SERVER
* super global and attempts to authenticate the user against MySQL. If
* the user cannot successfully they will be presented with a 401
* Unauthorized page.
*
* @todo I'm sure someone will find the access denied message offensive, so
* this will need to be made more generic. May also want to add in the
* ability for someone to add a custom message and/or landing page in
* the configuration as well.
* @todo I'm sure someone will find the access denied message offensive,
* so this will need to be made more generic. May also want to
* add in the ability for someone to add a custom message and/or
* landing page in the configuration as well.
*/
static function authenticate() {
$db = DB::getInstance();