fix phpdoc comment
[lhc/web/wiklou.git] / includes / AuthPlugin.php
1 <?php
2 /**
3 * @package MediaWiki
4 */
5 # Copyright (C) 2004 Brion Vibber <brion@pobox.com>
6 # http://www.mediawiki.org/
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License along
19 # with this program; if not, write to the Free Software Foundation, Inc.,
20 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 # http://www.gnu.org/copyleft/gpl.html
22
23 /**
24 * Authentication plugin interface. Instantiate a subclass of AuthPlugin
25 * and set $wgAuth to it to authenticate against some external tool.
26 *
27 * The default behavior is not to do anything, and use the local user
28 * database for all authentication. A subclass can require that all
29 * accounts authenticate externally, or use it only as a fallback; also
30 * you can transparently create internal wiki accounts the first time
31 * someone logs in who can be authenticated externally.
32 *
33 * This interface is new, and might change a bit before 1.4.0 final is
34 * done...
35 *
36 * @package MediaWiki
37 */
38 class AuthPlugin {
39 /**
40 * Check whether there exists a user account with the given name.
41 * The name will be normalized to MediaWiki's requirements, so
42 * you might need to munge it (for instance, for lowercase initial
43 * letters).
44 *
45 * @param string $username
46 * @return bool
47 * @access public
48 */
49 function userExists( $username ) {
50 # Override this!
51 return false;
52 }
53
54 /**
55 * Check if a username+password pair is a valid login.
56 * The name will be normalized to MediaWiki's requirements, so
57 * you might need to munge it (for instance, for lowercase initial
58 * letters).
59 *
60 * @param string $username
61 * @param string $password
62 * @return bool
63 * @access public
64 */
65 function authenticate( $username, $password ) {
66 # Override this!
67 return false;
68 }
69
70 /**
71 * Return true if the wiki should create a new local account automatically
72 * when asked to login a user who doesn't exist locally but does in the
73 * external auth database.
74 *
75 * This is just a question, and shouldn't perform any actions.
76 *
77 * @return bool
78 * @access public
79 */
80 function autoCreate() {
81 return false;
82 }
83
84 /**
85 * Return true to prevent logins that don't authenticate here from being
86 * checked against the local database's password fields.
87 *
88 * This is just a question, and shouldn't perform any actions.
89 *
90 * @return bool
91 * @access public
92 */
93 function strict() {
94 return false;
95 }
96
97 /**
98 * When creating a user account, optionally fill in preferences and such.
99 * For instance, you might pull the email address or real name from the
100 * external user database.
101 *
102 * The User object is passed by reference so it can be modified; don't
103 * forget the & on your function declaration.
104 *
105 * @param User $user
106 * @access public
107 */
108 function initUser( &$user ) {
109 # Override this to do something.
110 }
111 }
112
113 ?>