Handle htmlspecialchars() differences between PHP < 5.4 vs >= 5.4
[awl.git] / inc / AuthPlugin.php
blob01f7f193b66c04453d124e7eb49e27e4187ed6c9
1 <?php
2 /**
3 * Authentication handling class
5 * This class provides a basic set of methods which are used by the Session
6 * class to provide authentication.
8 * This class is expected to be replaced, overridden or extended in some
9 * instances to enable different pluggable authentication methods.
11 * @package awl
12 * @subpackage AuthPlugin
13 * @author Andrew McMillan <andrew@mcmillan.net.nz>
14 * @copyright Catalyst IT Ltd
15 * @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
18 /**
19 * A class for authenticating and retrieving user information
21 * @package awl
23 class AuthPlugin
25 /**#@+
26 * @access private
28 var $usr;
29 var $success;
30 /**#@-*/
32 /**#@+
33 * @access public
36 /**#@-*/
38 /**
39 * Create a new AuthPlugin object. This is as lightweight as possible.
41 * @param array $authparams An array of parameters used for this authentication method.
43 function AuthPlugin( $authparams ) {
44 $this->success = false;
47 /**
48 * Authenticate. Do whatever we need to authenticate a username / password.
50 * @param string $username The username of the person attempting to log in
51 * @param string $password The password the person is trying to log in with
52 * @return object The "user" object, containing fields matching the 'usr' database table
54 function Authenticate( $username, $password ) {
58 /**
59 * Notes:
60 * This could also be done as a process of "registering" functions to perform the authentication,
61 * so in the Session we call something to (e.g.) do the authentication and that looks in (e.g.)
62 * $c->authenticate_hook for a function to be called, or it just does the normal thing if
63 * that is not set.
64 * It might be a better way. I think I need to bounce these two ideas off some other people...
66 * In either case Session will need to split the fetching of session data from the fetching of
67 * usr data. So I'll look at doing that first.