Extension:CentralAuth
CentralAuthは、プロジェクト間で共有されるグローバルアカウントが可能です。 この拡張機能により、以下の新しい特別ページが追加されます。 Special:CentralAuth, Special:CentralLogin (一覧に表示されない特別ページ), Special:CentralAutoLogin (一覧に表示されない特別ページ), Special:CreateLocalAccount, Special:MergeAccount, Special:GlobalGroupMembership, Special:GlobalGroupPermissions, Special:WikiSets, Special:GlobalUsers, Special:MultiLock, Special:GlobalRenameUser, Special:GlobalRenameProgress
お使いのMediaWikiのバージョンに対応するCentralAuthのバージョンをダウンロードすることをお勧めします。
インストール
CentralAuth のインストールと使用の前提条件は、以下の セットアップ節を参照してください。 CentralAuth を有効にする準備ができたら、次に以下の指示に従ってください:
- 最新のスナップショットをダウンロードして、
extensions
ディレクトリに展開します。 - データベースを選択し、CentralAuthデータベーステーブルを作成してください。 使用するデータベースは既存でも、新規作成することもできす。拡張機能の使用する規定のデータベースの名前は
centralauth
です (以下$wgCentralAuthDatabase
をご参照ください)。 このデータベースを使用し、次にtables-generated.sql
を実行します。- Extension:AntiSpoof を使用する場合は、グローバルな
spoofuser
テーブルを作成する櫃行があります (ウィキを問わず見た目が似た利用者名を除外するため。) これを行う方法の一つとして、ローカルwikiのデータベースからspoofuser
テーブルのダンプを作成し、新しい$wgCentralAuthDatabase
にインポートします。
- Extension:AntiSpoof を使用する場合は、グローバルな
wfLoadExtension( 'CentralAuth' );
の追加先は、ご利用のウィキ単位で LocalSettings.php に、もしくはご利用のウィキごとにLocalSettings.php
に含まれた他の PHP ファイルです。- これで拡張機能が有効になるはずです。
ここで紹介するサンプルシェルとSQLコマンドは、CentralAuth のデータベースを作成してそこに spoofuser テーブルを転写してから、既存のユーザーデータをそこへ移行するために使います。 ご利用のウィキのインストール形態に合わせて、$wgDBname と $wgDBuser を該当する値に置換します。
新規データベースを作成 (この段階はオプション、既存のデータベースを使うなら本項目は飛ばしてテーブル作成の手順へ進みます):
$ cd extensions/CentralAuth
$ mysql -u root -p
(enter password for root SQL user)
CREATE DATABASE centralauth;
USE centralauth;
GRANT all on centralauth.* to '$wgDBuser'@'localhost';
quit
以下の記述は現時点の作業ディレクトリがご利用の MediaWiki インストレーションであることを前提にします (ご利用の CentralAuth ディレクトリではない点にご注意。)
統一認証テーブルを作成します(sql.php
の使用が推奨されます)。
シェルアクセスができない場合は、PHPMyAdminのようなデータベース管理ツールを使用してtables-generated.sql
をインポートすることもできます。
MediaWiki バージョン: | ≧ 1.38 Gerrit change 758563 |
php maintenance/sql.php --wikidb centralauth extensions/CentralAuth/schema/<データベースの種類>/tables-generated.sql
MediaWiki バージョン: | ≦ 1.37 Gerrit change 758563 |
php maintenance/sql.php --wikidb centralauth extensions/CentralAuth/central-auth.sql
AntiSpoof をインストールした環境では、テーブル作成はそれを経由します (代替案として既存の AntiSpoof テーブルを転写しておき、これまでのエントリを保存):
php maintenance/sql.php --wikidb centralauth extensions/CentralAuth/AntiSpoof/patch-antispoof-global.mysql.sql
利用者移行スクリプトの実行
$ php extensions/CentralAuth/maintenance/migratePass0.php
$ php extensions/CentralAuth/maintenance/migratePass1.php
以下の指示よりも、手順の解説の方がユーザー目線のセットアップを示しています。
セットアップ
初めに、wikiファミリを$wgConf
で設定する必要があり、そうしないとCentralAuthがあなたのwikiファミリに使用できません。
これには、$wgLocalDatabases
をセットして、$wgConf->wikis
、$wgConf->settings
(最小は$wgCanonicalServer
、$wgServer
、$wgArticlePath
)に割り当てることが含まれます。
例によく従って下さい。
設定コードをLocalSettings.php
のwfLoadExtension( 'CentralAuth' );
行の後に置くことを確認してください。
新しいウィキファミリーを作成する場合、各グループのウィキのデータベースが同じサフィックスを持つ方が簡単です(例えば、同じグループに属するウィキのデータベースenwiki
、dewiki
、frwiki
などは、すべて「wiki
」というサフィックスを持っているとします)。
拡張機能をインストール後、CentralAuthのデータベースにあるデータを集める必要があります。 グローバルアカウントを過去にさかのぼって設定するためには、migratePass0.phpおよびmigratePass1.phpのスクリプトを実行する必要があります。 最初のものは、CentralAuthデータベースにあなたのWikiに関する情報を保存します。一方、2番目のものは、自動移行ヒューリスティックを使用してグローバルアカウントを生成します。 利用者はSpecial:MergeAccountを通じて統合できます。 ドライランはテスト目的で使用することができます。
グローバルグループを有効にするには、CentralAuthデータベースのglobal_group_permissions
テーブルに、ggp_group='steward'
と(グループ管理インターフェイスへのアクセス用に)ggp_permission=globalgrouppermissions
のエントリを作成する必要があります。
使用することが推奨されるサンプルクエリー : INSERT INTO global_group_permissions (ggp_group,ggp_permission) VALUES ('steward','globalgrouppermissions'), ('steward','globalgroupmembership');
.
Then, run migrateStewards.php
to promote local stewards to global steward status.
There are various settings you may wish to modify (e.g. whether to provide single sign-on across a whole domain) listed in CentralAuth.php.
In particular, you will want to override the default value of $wgCentralAuthDatabase
if your CentralAuth database is named something other than 'centralauth'
.
wfLoadExtension
の行の後にLocalSettings.php
を設定してください。
wfLoadExtension( 'CentralAuth' );
$wgCentralAuthDatabase = 'mycentralauthdatabase';
リンクの挙動
このページは直近の情報を反映していません。 |
このページに加筆してください。 |
In July 2013 WMF changed its approach to logging users into multiple wikis.
When configured for this new approach, after successful login and account creation CentralAuth redirects to Special:CentralLogin/start?token=somevalue
on a "central login wiki", which sets cookies on that wiki and then redirects back to the logged-into wiki.
It omits the "login/account creation success" page, instead redirecting back to the "returnto" page that the user was originally on.
It places 1x1 pixel images in the footer of that page, in place of the icons formerly used on the "login/account creation success" page.
The settings for this are, roughly,
# General CentralAuth configuration
$wgCentralAuthCookies = true;
$wgCentralAuthAutoNew = true; // Parameter deleted from MediaWiki 1.27
$wgCentralAuthDatabase = 'centralauthDatabaseName'; // default is 'centralauth'
$wgCentralAuthAutoMigrate = true;
#$wgCentralAuthCookieDomain = '.example.org';
$wgCentralAuthAutoLoginWikis = array(
# Mapping from domain name to wiki id for other wikis to automatically login into
);
# Create the local account on pageview, set false to require a local login to create it.
$wgCentralAuthCreateOnView = true;
# Activates the redirect to the "central login wiki"
$wgCentralAuthLoginWiki = 'WikiIdOfLoginWiki';
# Skips the "login success" page
$wgCentralAuthSilentLogin = true;
# Deprecated, will be removed soon.
$wgCentralAuthUseOldAutoLogin = false;
$wgCentralAuthLoginWiki
is the id (usually the database-name) of the wiki to which CentralAuth will redirect on login and create account.
$wgCentralAuthAutoNew
means account creation will create a new global account (this parameter was deleted from MediaWiki 1.27).
Simulating SUL2 behavior on a single-instance development machine
You can simulate this new behavior on a single-instance development machine.
You can set $wgCentralAuthLoginWiki = $wgDBname
so CentralAuth makes its HTTP redirect requests to your same local wiki.
This will not exercise central login properly, but will activate its "returnto
" behavior.
CentralAuthは、グローバル利用者名用の独自の'centralauth'
データベースを使用します。
To determine the URL on the login wiki, CentralAuth uses WikiMap which assumes a wiki farm has been configured using $wgConf .
Configuration setup (in SiteConfiguration.php
) is very flexible; one way to set up a dummy single-wiki $wgConf
in LocalSettings.php
is:
// You can't just set wgConf values to the globals defined in Setup.php for your
// local wiki, because it hasn't run yet. You could hard-code $wgConf settings
// here, but instead we set the wgConf values in a hook that runs later.
$wgHooks['SetupAfterCache'][] = function() {
global $wgConf, $wgDBname,
$wgServer, $wgCanonicalServer, $wgArticlePath;
$wgConf->suffixes = array( $wgDBname );
$wgConf->settings['wgServer'][$wgDBname] = $wgServer;
$wgConf->settings['wgCanonicalServer'][$wgDBname] = $wgCanonicalServer;
$wgConf->settings['wgArticlePath'][$wgDBname] = $wgArticlePath;
return true;
};
This is in addition to the settings in #"SUL2" behavior above.
キャッシュの問題
最良の結果を得るために、memcachedの使用が推奨されます。
If you have only a single server, accelerator caches (CACHE_ACCEL
) like APCu can also work, but do not use them if you have multiple servers.
If you have no cache set up (i.e. CACHE_NONE
) for $wgMainCacheType
, or are using CACHE_DB
, then you need to make sure all your wikis use the same caching table.
By default, each wiki in your wiki farm will use the objectcache
table in its own database (with its own db prefix) when $wgMainCacheType
is set to CACHE_NONE
or CACHE_DB
.
これをCentralAuthで正常に動作させるために、中央のキャッシュテーブルを使用するようwikiを設定する必要があります。
If you want to make a central caching table in the centralauth
database (and assuming one of your existing wikis has a database name of enwiki
), run code like the following to copy the table to your other database:
CREATE TABLE centralauth.objectcache LIKE enwiki.objectcache
次に、以下の設定を全てのWikiに行い、中央のWikiが使用されるようにします :
$wgSharedDB = 'centralauth'; // or whatever database you use for central data
$wgSharedTables = array( 'objectcache' ); // remember to copy the table structure's to the central database first
$wgCentralAuthSessionCacheType = CACHE_DB; // Tell mediawiki to use objectcache database for central auth.
設定
パラメーター | 既定値 | コメント |
---|---|---|
$wgCentralAuthDatabase
|
'centralauth'
|
CentralAuthのデータを保存するデータベース名。
If this is not on the primary database connection, don't forget to also set up To use a database with a table prefix, set this variable to " |
$wgCentralAuthAutoMigrate
|
false
|
If true , existing unattached accounts will be automatically migrated if possible at first login.
新規アカウント作成の場合、添付が必要です。 If |
$wgCentralAuthAutoMigrateNonGlobalAccounts
|
false
|
If true , existing unattached accounts where no global account exists will be compared to see if a merge can be made based on passwords and emails with no clashes (all accounts merge).
以前は |
$wgCentralAuthStrict
|
false
|
If true , remaining accounts which have not been attached will be forbidden from logging in until they are resolved.
|
$wgCentralAuthDryRun
|
false
|
If true , merging won't actually be possible through the Special:MergeAccount interface.
|
$wgCentralAuthCookies
|
false
|
If true , global session and token cookies will be set alongside the per-wiki session and login tokens when users log in with a global account.
This allows other wikis on the same domain to transparently log them in. |
$wgCentralAuthLoginWiki
|
false
|
Database name of a central login wiki. This is an alternative to directly setting cross-domain cookies for each wiki in $wgCentralAuthAutoLoginWikis . If set, a single login wiki will use a session/cookie to handle unified login sessions across wikis.
On login, users will be redirected to the login wiki's Special:CentralLogin/login page and then redirected to Special:CentralLogin back on the originating wiki. In the process, the central login wiki cookie and session will be set. As the user accesses other wikis, the login wiki will be checked via JavaScript to check login status and set the local session and cookies. これには |
$wgCentralAuthCookieDomain
|
''
|
Domain to set global cookies for.
For instance, |
$wgCentralAuthCookiePrefix
|
'centralauth_'
|
Prefix for CentralAuth global authentication cookies. |
$wgCentralAuthCookiePath
|
'/'
|
Path for CentralAuth global authentication cookies. Set this variable if you want to restrict cookies to a certain path within the domain specified by $wgCentralAuthCookieDomain .
|
$wgCentralAuthAutoLoginWikis
|
[]
|
List of wiki IDs which should be called on login to try to set third-party cookies for the global session state.
The wiki ID is typically the database name, except when table prefixes are used, in which case it is the database name, a hyphen separator, and then the table prefix. This allows a farm with multiple second-level domains to set up a global session on all of them by hitting one wiki from each domain (en.wikipedia.org, en.wikinews.org, etc.). Done by accessing If empty, no other wikis will be hit. The key should be set to the cookie domain name. |
$wgCentralAuthAutoCreateWikis
|
[]
|
List of wiki IDs on which an attached local account should be created automatically when the global account is created.
The wiki ID is typically the database name, except when table prefixes are used, in which case it is the database name, a hyphen separator, and then the table prefix. |
$wgCentralAuthLoginIcon
|
false
|
Local filesystem path to the icon returned by Special:CentralAutoLogin should be a 20x20px PNG.
|
$wgCentralAuthPrefsForUIReload
|
[ 'skin', 'language', 'thumbsize', 'underline', 'stubthreshold', 'showhiddencats', 'justify', 'numberheadings', 'editondblclick', 'editsection', 'editsectiononrightclick', 'usenewrc', 'extendwatchlist' ]
|
User preferences for which we should recommend reloading the page after a successful central login query.
If you need to do something more complicated than just |
$wgCentralAuthCookiesP3P
|
true
|
Specify a P3P header value to be used when setting CentralAuth cookies on the login wiki ($wgCentralAuthLoginWiki ).
When set Set false to disable sending the P3P header altogether. Note this will likely break the auto-login check in IE, unless the header is being set globally elsewhere (e.g. in the webserver). Otherwise, whatever string is assigned here will be sent as the value of the P3P header. @var bool|string |
$wgCentralAuthCreateOnView
|
false
|
If true , local accounts will be created for active global sessions on any page view. This is kind of creepy, so we're gonna have it off for a little bit.
With other default options, the local auto creation will be held off until an active login attempt, while global sessions will still automatically log in those who already have a merged account. |
$wgCentralAuthRC
|
[]
|
Array of settings for sending the CentralAuth events to the RC Feeds.
@example $wgRCFeeds['example'] = array( 'uri' => "udp://localhost:1336", ); |
$wgCentralAuthLockedCanEdit
|
[]
|
List of local pages global users may edit while being globally locked. |
$wgDisableUnmergedEditing
|
false
|
Disable editing for non-global accounts (except on NS_USER_TALK and NS_PROJECT_TALK ).
|
$wgCentralAuthWikisPerSuppressJob
|
10
|
Size of wikis handled in one suppress user job. Keep in mind that one wiki requires ~10 queries.
|
$wgCentralAuthReadOnly
|
false
|
Like $wgReadOnly , used to set extension to database read only mode.
@var bool |
$wgCentralAuthUseEventLogging
|
false
|
Use the EventLogging extension to measure various activities. |
$wgCentralAuthPreventUnattached
|
false
|
Don't allow new unattached accounts to be created.
@var bool |
$wgCentralAuthEnableGlobalRenameRequest
|
false
|
Feature flag for Special:GlobalRenameRequest .
@var bool |
$wgCentralAuthCheckSULMigration
|
false
|
Enable special logic to attempt to ease the user facing impact of forced user migrations.
@var bool |
$wgCentralAuthGlobalPasswordPolicies
|
[]
|
Global password policies. These are applied like local password policies, the strongest policy applicable to a user is used. ローカルグループ (当該利用者がいずれのウィキであってもそのグループに所属しているなら方針を当該利用者に適用) もグローバルグループもさまざまな方針の適用対象です。
@var array |
$wgCentralAuthUseSlaves
|
false
|
読み込みの場合はマスターではなくスレーブのデータベース類をご利用ください。
@var bool |
$wgOverrideCentralIdLookupProvider
|
true
|
false の設定により、どうしてもその必要がある場合は $wgCentralIdLookupProvider に対する'CentralAuth' の使用を回避して'local' を使うことができます。 これはCentralAuth をインストールしたなら、ほぼ全ての場合にCentralAuth を使用することが望まれるため、既定から外してあります。
@var bool |
$wgGlobalRenameBlacklist
|
null
|
A list of users who won't be allowed to create new global rename requests through Special:GlobalRenameRequest.
There are two ways to set it:
You can use the exact names or regular expressions, see @var Title|string|null |
$wgGlobalRenameBlacklistRegex
|
false
|
Whether the list in $wgGlobalRenameBlacklist is using regular expressions. If set to false , users will be matched literally, if set to true the username will be tested against the regular expressions (provided that they are valid).
@var bool |
$wgCentralAuthGlobalBlockInterwikiPrefix
|
"global"
|
When globally suppressing a user, a block against this user is inserted in all wikis. CentralAuth will set the author of theses blocks as $wgCentralAuthGlobalBlockInterwikiPrefix>(user-who-made-the-suppression's nickname) . For example, if $wgCentralAuthGlobalBlockInterwikiPrefix = "Admins"; , and Joe suppresses John, all wikis will show in BlockList a block against John made by Admins>Joe .
@var string |
古い構成パラメータ
パラメーター | 有効期間 | 既定値 | コメント |
---|---|---|---|
$wgCentralAuthAutoNew
|
MediaWiki 1.12–1.26 (2a97957–32276b0) | false
|
true の場合、どの場所でも未使用の利用者名に対して新しいアカウントがグローバルに登録されます。
|
使用法
単一利用者ログインシステム (SUL) を採用、MediaWiki のAuthPlugin システムを援用。 利用者の作成とログインは単一の統一利用者テーブルを用いて、全てのウィキでグローバルに実行されます。 ローカルの利用者アカウントはいずれにしてもアカウント作成・ログイン時に自動的に作成されることに留意してください。
この拡張機能はまた、グローバルな利用者グループを実行し、そこにはグローバルアカウントを登録できます。
利用者権限
CentralAuth は複数の新しい利用者権限を定義します。
利用者権限 | 技能 | 既定のグループ | 状態 |
---|---|---|---|
centralauth-admin
|
Read-only access to global account status | Not applicable | Inactive; defunct |
centralauth-createlocal
|
Forcibly create a local account for a global account | Stewards and sysops | Active in MW 1.36+ |
centralauth-lock
|
Prevent users from logging in on any wiki | Stewards | Active |
centralauth-suppress
|
Suppress or unhide global accounts | Stewards | Active |
centralauth-rename
|
Rename global accounts | Stewards | Active |
centralauth-unmerge
|
Unmerge global accounts from a local account | Stewards | Active |
centralauth-merge
|
Merge all CentralAuth accounts globally | All users | Active; usually automatic |
globalgrouppermissions
|
Manage permissions of global groups | Global Stewards | Active; not assigned to local stewards by default |
globalgroupmembership
|
Edit membership to global groups | Global Stewards | Active; not assigned to local stewards by default |
機能
Single-user login (SUL)
A user with an account on more than one wiki may use Special:MergeAccount to create their global user account, which can then be used on any wiki. Users with the centralauth-unmerge
permission (given to stewards by default) can undo a merging of a global account, where the passwords are all reset back to the pre-merge setting.
User accounts can now also be renamed globally.
グローバルユーザーをロックして非表示にする
グローバル アカウントは、既定で local グループ 'stewards' に与えられている centralauth-lock
と centralauth-suppress
の権限を持つ利用者によって locked または hidden にすることができます。
ロックされたグローバルアカウントは、現在ログインしているすべてのWikiのセッションから即座にログアウトされます。
非表示のグローバル アカウントの利用者名は、グローバル アカウント記録以外の記録には表示されません。
Wikiのセット
A wiki set is a group of wikis specified by a user with the globalgrouppermissions
right.
Sets can be opt-in (wikis are not in it by default) or opt-out (wikis are in it unless opted out).
グローバル利用者グループ
Once you have enabled global user groups as described in the installation section, a migrated steward can use the Special:GlobalGroupPermissions interface to configure global user groups, and their rights.
A global user group is active on all wikis (the users in it have its rights on all the wikis) by default, unless the group has been specified to only be active on a specific wiki set (the users in the group only have the rights if they are on a wiki in the set).
Global group permissions are not listed at Special:ListUsers, but instead Special:GlobalUsers.
They are assigned by a user with the globalgroupmembership
permission (by default the global group stewards
), and give the specified rights to the user even if the local rights defined by $wgGroupPermissions
do not do so.
ライセンスとダウンロード
この拡張機能には GNU 一般公衆ライセンス 2.0 以降が適用され、ダウンロードは Git から、もしくは [[git:mediawiki/extensions/CentralAuth/+/HEAD/{{{1}}}|web-based viewer]]経由でアクセス可能です。
ソフトウェアは現状のまま支給されます。 ウィキメディアのウィキの需要により、更新を行う可能性があります。もしくは重大な脆弱性が発見された場合。
API
脚注
関連項目
- Single login specifications はメタウィキの単一ログインの要件
- Help:Unified loginはメタウィキの統一ログインのヘルプ
$wgSharedDB
- Global session threat assessment
- 統一したウォッチリスト
- CentralAuth制御フロー
- wikitech:Stuck global renames
この拡張機能は 1 つ以上のウィキメディアのプロジェクトで使用されています。 これはおそらく、この拡張機能が安定していて高いトラフィックのウェブサイトでも十分に動作することを意味します。 この拡張機能がインストールされている場所を確認するには、ウィキメディアの設定ファイル CommonSettings.php および InitialiseSettings.php 内で、この拡張機能の名前を探してください。 特定のウィキにインストールされている拡張機能の完全な一覧は、そのウィキの Special:Version ページにあります。 |
この拡張機能は以下のパッケージ/ウィキファームに含まれています: This is not an authoritative list. Some wiki farms/hosts may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |