3
* OpenID.setup.php -- Make MediaWiki an OpenID consumer and server
4
* Copyright 2006,2007 Internet Brands (http://www.internetbrands.com/)
5
* Copyright 2007,2008 Evan Prodromou <evan@prodromou.name>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
* @author Evan Prodromou <evan@prodromou.name>
22
* @addtogroup Extensions
25
if (!defined('MEDIAWIKI')) {
29
define('MEDIAWIKI_OPENID_VERSION', '0.8.4dev');
31
# CONFIGURATION VARIABLES
33
# Whether to hide the "Login with OpenID link" link; set to true if you already have this link in your skin.
35
$wgHideOpenIDLoginLink = false;
37
# Location of the OpenID login logo. You can copy this to your server if you want.
39
$wgOpenIDLoginLogoUrl = 'http://www.openid.net/login-bg.gif';
41
# Whether to show the OpenID identity URL on a user's home page. Possible values are 'always', 'never', or 'user'
42
# 'user' lets the user decide.
44
$wgOpenIDShowUrlOnUserPage = 'user';
46
# These are trust roots that we don't bother asking users
47
# whether the trust root is allowed to trust; typically
48
# for closely-linked partner sites.
50
$wgOpenIDServerForceAllowTrust = array();
52
# Where to store transitory data. Only supported type is 'file'.
54
$wgOpenIDServerStoreType = 'file';
56
# If the store type is set to 'file', this is is the name of a
57
# directory to store the data in.
59
$wgOpenIDServerStorePath = "/tmp/$wgDBname/openidserver/";
61
# Defines the trust root for this server
62
# If null, we make a guess
66
# When using deny and allow arrays, defines how the security works.
67
# If true, works like "Order Allow,Deny" in Apache; deny by default,
68
# allow items that match allow that don't match deny to pass.
69
# If false, works like "Order Deny,Allow" in Apache; allow by default,
70
# deny items in deny that aren't in allow.
72
$wgOpenIDConsumerDenyByDefault = false;
74
# Which partners to allow; regexps here. See above.
76
$wgOpenIDConsumerAllow = array();
78
# Which partners to deny; regexps here. See above.
80
$wgOpenIDConsumerDeny = array();
82
# Where to store transitory data. Only supported type is 'file'.
84
$wgOpenIDConsumerStoreType = 'file';
86
# If the store type is set to 'file', this is is the name of a
87
# directory to store the data in.
89
$wgOpenIDConsumerStorePath = "/tmp/$wgDBname/openidconsumer/";
91
# Expiration time for the OpenID cookie. Lets the user re-authenticate
92
# automatically if their session is expired. Only really useful if
93
# it's much greater than $wgCookieExpiration. Default: about one year.
95
$wgOpenIDCookieExpiration = 365 * 24 * 60 * 60;
97
# Only allow login with OpenID. Careful -- this means everybody!
99
$wgOpenIDOnly = false;
101
# If true, user accounts on this wiki *cannot* be used as
102
# OpenIDs on other sites.
104
$wgOpenIDClientOnly = false;
106
# END CONFIGURATION VARIABLES
108
$wgExtensionCredits['other'][] = array(
110
'version' => MEDIAWIKI_OPENID_VERSION,
111
'author' => 'Evan Prodromou',
112
'url' => 'http://www.mediawiki.org/wiki/Extension:OpenID',
113
'description' => 'Lets users login to the wiki with an [http://openid.net/ OpenID] and login to other OpenID-aware Web sites with their wiki user account',
114
'descriptiomsg' => 'openid-desc',
117
function OpenIDGetServerPath() {
118
$rel = 'Auth/OpenID/Server.php';
120
foreach ( explode( PATH_SEPARATOR, get_include_path() ) as $pe ) {
121
$full = $pe . DIRECTORY_SEPARATOR . $rel;
122
if ( file_exists( $full ) ) {
129
$dir = dirname( __FILE__ ) . '/';
130
$wgExtensionMessagesFiles['OpenID'] = $dir . 'OpenID.i18n.php';
131
$wgExtensionAliasesFiles['OpenID'] = $dir . 'OpenID.alias.php';
133
$wgAutoloadClasses['OpenIDHooks'] = $dir . 'OpenID.hooks.php';
135
# Autoload common parent with utility methods
136
$wgAutoloadClasses['SpecialOpenID'] = $dir . 'SpecialOpenID.body.php';
138
$wgAutoloadClasses['SpecialOpenIDLogin'] = $dir . 'SpecialOpenIDLogin.body.php';
139
$wgAutoloadClasses['SpecialOpenIDFinish'] = $dir . 'SpecialOpenIDFinish.body.php';
140
$wgAutoloadClasses['SpecialOpenIDConvert'] = $dir . 'SpecialOpenIDConvert.body.php';
141
$wgAutoloadClasses['SpecialOpenIDServer'] = $dir . 'SpecialOpenIDServer.body.php';
142
$wgAutoloadClasses['SpecialOpenIDXRDS'] = $dir . 'SpecialOpenIDXRDS.body.php';
144
# Gets stored in the session, needs to be reified before our setup
145
$wgAutoloadClasses['Auth_OpenID_CheckIDRequest'] = OpenIDGetServerPath();
147
$wgHooks['PersonalUrls'][] = 'OpenIDHooks::onPersonalUrls';
148
$wgHooks['ArticleViewHeader'][] = 'OpenIDHooks::onArticleViewHeader';
149
$wgHooks['SpecialPage_initList'][] = 'OpenIDHooks::onSpecialPage_initList';
150
$wgHooks['LoadExtensionSchemaUpdates'][] = 'OpenIDHooks::onLoadExtensionSchemaUpdates';
151
$wgHooks['RenderPreferencesForm'][] = 'OpenIDHooks::onRenderPreferencesForm';
152
$wgHooks['InitPreferencesForm'][] = 'OpenIDHooks::onInitPreferencesForm';
153
$wgHooks['ResetPreferences'][] = 'OpenIDHooks::onResetPreferences';
154
$wgHooks['SavePreferences'][] = 'OpenIDHooks::onSavePreferences';