Class: SessionHandler_Cookie extends SessionHandler
- Package: saf.Session
- Author: John Luxford <lux@simian.ca>
- Copyright: Copyright (C) 2001-2003, Simian Systems Inc.
- License: http://www.sitellite.org/index/license Simian Open Software License
- Version: 1.2, 2002-11-09, $Id: Cookie.php,v 1.4 2008/02/20 12:32:32 lux Exp $
- Access: public
Provides a Cookie-based authentication client handler to the saf.Session
Package.
New in 1.2:
- Added a $cookieexpires property, so you can have sessions that can expire
in a certain amount of time, not just when the browser closes.
Usage Example
<?php
$c = new SessionHandler_Cookie;
$c->cookiename = 'sessid';
$c->cookiedomain = 'www.sitename.com';
// or
$c->setProperties (array (
'cookiename' => 'sessid',
'cookiedomain' => 'www.sitename.com',
));
$c->sendAuthRequest ();
?>
Properties
$access = array ()
$status = array ()
$roles = array ()
$teams = array ()
$resources = array ()
$user = array ()
$prefs = array ()
$_prefs = array ()
$path
$realm
$cancelmessage = 'You do not have permission to access this resource.'
$cookiename = 'sitellite_session_id'
- Access: public
Name of the cookie. Defaults to 'sitellite_session_id'.
$cookieexpires = 0
- Access: public
Expiration of cookie. Defaults to 0, which means the cookie
will expire when the browser closes.
$cookiedomain
- Access: public
Domain value of the cookie.
$cookiepath = '/'
- Access: public
Path value of the cookie. Defaults to '/'.
$cookiesecure = 0
- Access: public
Secure value of the cookie. May be 1 or 0, and defaults to 0.
$usernamefield = 'username'
- Access: public
The name of the username field in the form (uses saf.MailForm)
created by sendAuthRequest(). Defaults to 'username'.
$passwordfield = 'password'
- Access: public
The name of the password field in the form
created by sendAuthRequest(). Defaults to 'password'.
$hiddenfields = array ()
- Access: public
A list of hidden form fields and their values.
$usernametext = 'Username'
- Access: public
The alt text of the username field in the form
created by sendAuthRequest(). Defaults to 'Username'.
$passwordtext = 'Password'
- Access: public
The alt text of the password field in the form
created by sendAuthRequest(). Defaults to 'Password'.
$submittext = 'Sign In'
- Access: public
The alt text of the submit button in the form
created by sendAuthRequest(). Defaults to 'Sign In'.
$formtemplate = false
- Access: public
The template of the form created by sendAuthRequest().
Defaults to false (no template).
$usernamerules = array ()
- Access: public
A list of rules for the username form field. The keys are
the rules and the values are the invalid messages.
$passwordrules = array ()
- Access: public
A list of rules for the password form field. The keys are
the rules and the values are the invalid messages.
$formmessage = 'Please enter your username and password.'
- Access: public
The welcome message of the form. Defaults to
'Please enter your username and password.'
$invalidmessage = 'Sorry, the password you specified was invalid. Please try again.'
- Access: public
The invalid message of the form. Defaults to
'Sorry, the password you specified was invalid. Please try again.'
$timeoutmessage = 'Sorry, your session has timed out. Please sign in again to continue.'
- Access: public
The timeout message of the form. Defaults to
'Sorry, your session has timed out. Please sign in again to continue.'
Methods
start ($id, $authorized = false)
- Access: public
- Return: boolean
Initializes the communication with the client. In the case
of this handler, if the $authorized value is true it sets the session
cookie with the $id value.
changeTimeout ($newduration)
- Access: public
Re-sends the session cookie with a new timeout value.
sendAuthRequest ()
- Access: public
Sends the request for a username and password. This would be
an HTML form in this case.
gatherParameters ($sessionidname = 'sitellite_session_id')
- Access: public
- Return: array
Provides values for the username, password, and session id
(if applicable) to the main Session object. This is passed off to
the handlers because they know more about the client than the main
object does.
close ()
- Access: public
Unsets the session cookie.
