From f0ecaaf521228f582be724b8be5588be7e298e86 Mon Sep 17 00:00:00 2001 From: rurban Date: Mon, 12 Apr 2004 18:29:15 +0000 Subject: [PATCH] exp. Session auth for already authenticated users from another app git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3303 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- index.php | 13 ++++++++++++- lib/WikiUserNew.php | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index b62e26071..343f2242a 100644 --- a/index.php +++ b/index.php @@ -74,7 +74,7 @@ define('ENABLE_USER_NEW',true); // this will disappear with 1.4.0 define ('PHPWIKI_VERSION', '1.3.10pre'); require "lib/prepend.php"; -rcs_id('$Id: index.php,v 1.139 2004-04-12 16:24:28 rurban Exp $'); +rcs_id('$Id: index.php,v 1.140 2004-04-12 18:29:12 rurban Exp $'); ///////////////////////////////////////////////////////////////////// // @@ -474,6 +474,7 @@ if (!defined('ALLOW_USER_PASSWORDS')) define('ALLOW_USER_PASSWORDS', true); // Use Apache's htpasswd to manage this file. // HttpAuth: Use the protection by the webserver (.htaccess) or // enforce it +// Session: Re-use an existing user-session. AUTH_SESS_USER and AUTH_SESS_LEVEL if (defined('ALLOW_USER_PASSWORDS')) { @@ -489,6 +490,7 @@ if (defined('ALLOW_USER_PASSWORDS')) { // "IMAP", // define IMAP_AUTH_HOST // "POP3", // define POP3_AUTH_HOST // "File", // define AUTH_USER_FILE and opt. AUTH_USER_FILE_STORABLE +// "Session", // define AUTH_SESS_USER and AUTH_SESS_LEVEL ) ; if (!defined('PASSWORD_LENGTH_MINIMUM')) define('PASSWORD_LENGTH_MINIMUM', 2); @@ -542,6 +544,12 @@ if (!defined('IMAP_AUTH_HOST')) define('IMAP_AUTH_HOST', 'localhost:143/imap/n // set this to true if the user may change his password into this file. //if (!defined('AUTH_USER_FILE_STORABLE')) define('AUTH_USER_FILE_STORABLE',false); +// Session auth: +// Name of the session variable, which holds the already authenticated username. +//if (!defined('AUTH_SESS_USER')) define('AUTH_SESS_USER', 'userid'); +// Which level will be the user? 1=Bogo or 2=Pass +//if (!defined('AUTH_SESS_LEVEL')) define('AUTH_SESS_LEVEL', 2); + // Group membership: //if (!defined('GROUP_METHOD')) define('GROUP_METHOD', "NONE"); if (!defined('GROUP_METHOD')) define('GROUP_METHOD', "WIKIPAGE"); @@ -952,6 +960,9 @@ if (defined('VIRTUAL_PATH') and defined('USE_PATH_INFO')) { //include "lib/main.php"; // $Log: not supported by cvs2svn $ +// Revision 1.139 2004/04/12 16:24:28 rurban +// 1.3.10pre, JS_SEARCHREPLACE => pref option +// // Revision 1.138 2004/04/12 12:27:07 rurban // more notes and themes // diff --git a/lib/WikiUserNew.php b/lib/WikiUserNew.php index cd89f22a9..c824c2ac3 100644 --- a/lib/WikiUserNew.php +++ b/lib/WikiUserNew.php @@ -1,5 +1,5 @@ _prefs = $prefs; + if (!defined("AUTH_SESS_USER") or !defined("AUTH_SESS_LEVEL")) { + trigger_error( + "AUTH_SESS_USER or AUTH_SESS_LEVEL is not defined for the SessionPassUser method", + E_USER_ERROR); + exit; + } + $sess =& $GLOBALS['HTTP_SESSION_VARS']; + // FIXME: user hash: "[user][userid]" or object "user->id" + $this->_userid = $sess[AUTH_SESS_USER]; + if (!isset($this->_prefs->_method)) + _PassUser::_PassUser($this->_userid); + $this->_level = AUTH_SESS_LEVEL; + $this->_authmethod = 'Session'; + } + function userExists() { + return !empty($this->_userid); + } + function checkPass($submitted_password) { + return $this->userExists() and $this->_level; + } + function mayChangePass() { + return false; + } +} /** * Baseclass for PearDB and ADODB PassUser's @@ -2731,6 +2767,12 @@ extends UserPreferences // $Log: not supported by cvs2svn $ +// Revision 1.52 2004/04/12 13:04:50 rurban +// added auth_create: self-registering Db users +// fixed IMAP auth +// removed rating recommendations +// ziplib reformatting +// // Revision 1.51 2004/04/11 10:42:02 rurban // pgsrc/CreatePagePlugin // -- 2.45.0