blob: 8ecf4e40de2e0ad5f8c5074efe2fdfbfa2f31683 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<?php
abstract class PluggableAuth {
/**
* @since 1.0
*
* @param int &$id The user's user ID
* @param string &$username The user's user name
* @param string &$realname The user's real name
* @param string &$email The user's email address
* @param string &$errorMessage Returns a descritive message if
* there's an error
*/
abstract public function authenticate( &$id, &$username, &$realname,
&$email, &$errorMessage );
/**
* @since 1.0
*
* @param User &$user The user
*/
abstract public function deauthenticate( User &$user );
/**
* @since 1.0
*
* @param int $id The user's user ID
*/
abstract public function saveExtraAttributes( $id );
private static $instance = null;
/**
* @since 2.0
* @return PluggableAuth a PluggableAuth object
*/
public static function singleton() {
wfDebugLog( 'PluggableAuth', 'Getting PluggableAuth singleton' );
wfDebugLog( 'PluggableAuth', 'Class name: ' . $GLOBALS['wgPluggableAuth_Class'] );
if ( !is_null( self::$instance ) ) {
wfDebugLog( 'PluggableAuth', 'Singleton already exists' );
return self::$instance;
} elseif ( isset( $GLOBALS['wgPluggableAuth_Class'] ) &&
class_exists( $GLOBALS['wgPluggableAuth_Class'] ) &&
is_subclass_of( $GLOBALS['wgPluggableAuth_Class'],
'PluggableAuth' ) ) {
self::$instance = new $GLOBALS['wgPluggableAuth_Class'];
return self::$instance;
}
wfDebugLog( 'PluggableAuth', 'Could not get authentication plugin instance.' );
return false;
}
}
|