Extension:CentralAuth

From mediawiki.org
This page is a translated version of the page Extension:CentralAuth and the translation is 40% complete.
Outdated translations are marked like this.
MediaWiki 拡張機能マニュアル
CentralAuth
リリースの状態: 安定
実装 利用者識別 , データベース , 特別ページ , API
説明 グローバルアカウントへの統合を可能にする
作者 Brooke Vibberトーク
互換性の方針 MediaWiki とともにリリースされるスナップショット。 master には後方互換性がありません。
MediaWiki >= 1.42
データベースの変更 はい
テーブル globalnames
localnames
globaluser
localuser
global_user_groups
global_group_permissions
wikiset
global_group_restrictions
renameuser_status
renameuser_queue
users_to_rename
global_edit_count
global_user_autocreate_serial
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
  • $wgCentralAuthAutoLoginWikis
  • $wgCentralAuthCookies
  • $wgCentralAuthIpoidDenyAccountCreationTunnelTypes
  • $wgCentralAuthIpoidCheckAtAccountCreationLogOnly
  • $wgCentralAuthEnableGlobalRenameRequest
  • $wgCentralAuthIpoidRequestTimeoutSeconds
  • $wgCentralAuthCookiePath
  • $wgCentralAuthRC
  • $wgCentralAuthIpoidCheckAtAccountCreation
  • $wgCentralAuthGlobalBlockInterwikiPrefix
  • $wgCentralAuthAutoMigrateNonGlobalAccounts
  • $wgCentralAuthIpoidUrl
  • $wgCentralAuthDatabase
  • $wgCentralAuthDryRun
  • $wgCentralAuthAutoMigrate
  • $wgCentralAuthTokenSessionTimeout
  • $wgCentralAuthSessionCacheType
  • $wgGlobalRenameDenylist
  • $wgCentralAuthOldNameAntiSpoofWiki
  • $wgCentralAuthLoginIcon
  • $wgCentralAuthStrict
  • $wgCentralAuthReadOnly
  • $wgCentralAuthLoginWiki
  • $wgCentralAuthIpoidDenyAccountCreationRiskTypes
  • $wgCentralAuthGlobalPasswordPolicies
  • $wgCentralAuthWikisPerSuppressJob
  • $wgCentralAuthCookieDomain
  • $wgCentralAuthPrefsForUIReload
  • $wgCentralAuthAutoCreateWikis
  • $wgCentralAuthCookiePrefix
  • centralauth-createlocal
  • centralauth-merge
  • centralauth-unmerge
  • centralauth-lock
  • centralauth-suppress
  • globalgrouppermissions
  • globalgroupmembership
  • centralauth-rename
Quarterly downloads 60 (Ranked 93rd)
translatewiki.net で翻訳を利用できる場合は、CentralAuth 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · バグを報告

CentralAuth allows merging several existing separate account systems into one global account system.

警告 警告: CentralAuthは、共通認証用テーブルに統合される必要のある何百万ものアカウントを既に持っているウィキメディアプロジェクトのために特別に設計されました。

一から新たなウィキを立ち上げようとしていて、既存アカウントを共通認証用テーブルに統合する必要がない場合には、CentralAuth を使うより $wgSharedDB を使って共通認証アカウントを設定した方がずっと簡単です。[1][2]

しかしながら、$wgSharedDB は単に利用者名作成の衝突回避には役立つものの、ユニバーサルなサインインなどの処理は対象外で (利用者は個別のウィキごとにサインインが必要)、クラスター横断型アカウントの権限やその管理には対応しません。 この拡張機能の構成は、上記の機能性を実現するため複雑です。

If you end up using this extension on a third-party wiki, it is likely that you will end up having to troubleshoot complex issues that potentially require diving into the source code to resolve.

You have been warned.

インストール

CentralAuth のインストールと使用の前提条件は、以下の セットアップ節を参照してください。 CentralAuth を有効にする準備ができたら、次に以下の指示に従ってください:

  1. Install Extension:AntiSpoof , since it is a required dependency.
  2. 最新のスナップショットをダウンロードして、extensionsディレクトリに展開します。
  1. データベースを選択し、CentralAuthデータベーステーブルを作成してください。

使用するデータベースは既存でも、新規作成することもできす。拡張機能の使用する規定のデータベースの名前はcentralauthです (以下$wgCentralAuthDatabaseをご参照ください)。 このデータベースを使用し、次にtables-generated.sqlを実行します。

    • Extension:AntiSpoof を使用する場合は、グローバルな spoofuser テーブルを作成する櫃行があります (ウィキを問わず見た目が似た利用者名を除外するため。) これを行う方法の一つとして、ローカルwikiのデータベースからspoofuserテーブルのダンプを作成し、新しい$wgCentralAuthDatabaseにインポートします。
  1. wfLoadExtension( 'CentralAuth' ); の追加先は、ご利用のウィキ単位で LocalSettings.php に、もしくはご利用のウィキごとに LocalSettings.php に含まれた他の PHP ファイルです。
  2. これで拡張機能が有効になるはずです。

Create a new database

ここで紹介するサンプルシェルと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

Run maintenance scripts

以下の記述は現時点の作業ディレクトリがご利用の MediaWiki インストレーションであることを前提にします (ご利用の CentralAuth ディレクトリではない点にご注意。) 統一認証テーブルを作成します(sql.php の使用が推奨されます)。

php maintenance/run.php sql --wikidb centralauth extensions/CentralAuth/schema/<データベースの種類>/tables-generated.sql

AntiSpoof をインストールした環境では、テーブル作成はそれを経由します (代替案として既存の AntiSpoof テーブルを転写しておき、これまでのエントリを保存):

php maintenance/run.php sql --wikidb centralauth extensions/AntiSpoof/sql/<db_type>/tables-generated.sql

利用者移行スクリプトの実行

$ php maintenance/run.php CentralAuth:migratePass0.php
$ php maintenance/run.php CentralAuth:migratePass1.php

アップグレード

CentralAuth is designed for large wiki farms who run database updates manually in order to enable zero-downtime upgrades. For that reason, the CentralAuth database will not be updated with the usual upgrade process. Third-party users are expected to follow CentralAuth development and apply database migrations manually instead.

セットアップ

警告 警告: 異なるプライマリドメインを横断するログインを実現するには、統一ログイン ウィキを作る必要があります (つまりご利用のウィキが同一のドメインのサブドメインの配下にない場合。) 詳細は下記を参照してください。

初めに、wikiファミリ$wgConf で設定する必要があり、そうしないとCentralAuthがあなたのwikiファミリに使用できません。 これには、$wgLocalDatabases をセットして、$wgConf->wikis$wgConf->settings(最小は$wgCanonicalServer $wgServer $wgArticlePath )に割り当てることが含まれます。 によく従って下さい。 新しいウィキファミリーを作成する場合、各グループのウィキのデータベースが同じサフィックスを持つ方が簡単です(例えば、同じグループに属するウィキのデータベースenwikidewikifrwikiなどは、すべて「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, promote some users into stewards:

INSERT IGNORE INTO global_user_groups (gug_user, gug_group) VALUES ((SELECT gu_id FROM globaluser WHERE gu_name='Admin'), 'steward');

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';

リンクの挙動

警告 警告: As all logged in users will have a session in the central login wiki, you are recommended to set up a new wiki with as few extensions installed as possible (not using an existing wiki for this purpose). これにより、XSSの脆弱性のリスクが軽減されます。
警告 警告: SameSite Cookieポリシーにより、新しいバージョンのGoogle Chromeではユニバーサルサインオンが機能しない可能性があります。 解決方法 :
$wgCookieSameSite = "None";
$wgUseSameSiteLegacyCookies = true;
さらに、サイトをHTTPSで稼働させる必要があります。

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;
$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
);

# Activates the redirect to the "central login wiki"
$wgCentralAuthLoginWiki = 'WikiIdOfLoginWiki';

$wgCentralAuthLoginWiki is the id (usually the database-name) of the wiki to which CentralAuth will redirect on login and create account.

キャッシュの問題

最良の結果を得るために、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.

HTTP and HTTPS

Since 2023, CentralAuth does not support mixed-protocol HTTP/HTTPS wikis, only pure-HTTPS wikis (with $wgForceHTTPS set to true) and pure-HTTP wikis (primarily for local testing).phab:T348852

設定

CentralAuth.php での構成設定
パラメーター 既定値 コメント
$wgCentralAuthDatabase 'centralauth' CentralAuthのデータを保存するデータベース名。

If this is not on the primary database connection, don't forget to also set up $wgDBservers to have an entry with a groupLoads setting for the 'CentralAuth' group. Alternatively you can use $wgLBFactoryConf to set up an LBFactoryMulti object.

To use a database with a table prefix, set this variable to "{$database}-{$prefix}".

$wgCentralAuthAutoMigrate false If true, existing unattached accounts will be automatically migrated if possible at first login.

新規アカウント作成の場合、添付が必要です。

If false, unattached accounts will not be harassed unless the individual account has opted in to migration.

$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).

以前は$wgCentralAuthAutoMigrateに管理されていました。

$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.

これには $wgCentralAuthCookies が必要です。

$wgCentralAuthCookieDomain '' Domain to set global cookies for.

For instance, '.wikipedia.org' to work on all wikipedia.org subdomains instead of just the current one. Leave blank to set the cookie for the current domain only, such as if all your wikis are hosted on the same subdomain.

$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 Special:CentralAutoLogin/start on each wiki.

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 $userOptionsLookup->getOption( $user, $pref ) !== $userOptionsLookup->getDefaultOption( $pref ), use the hook CentralAuthIsUIReloadRecommended.

$wgCentralAuthRC [] Array of settings for sending the CentralAuth events to the RC Feeds.

@example $wgRCFeeds['example'] = array( 'uri' => "udp://localhost:1336", );

$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

$wgCentralAuthEnableGlobalRenameRequest false Feature flag for Special:GlobalRenameRequest.

@var bool

$wgCentralAuthGlobalPasswordPolicies [] Global password policies. These are applied like local password policies, the strongest policy applicable to a user is used. ローカルグループ (当該利用者がいずれのウィキであってもそのグループに所属しているなら方針を当該利用者に適用) もグローバルグループもさまざまな方針の適用対象です。

@var array

$wgGlobalRenameDenylist 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:

  • Using a wiki-page: use a Title object to have a wiki-page (MediaWiki:GlobalRenameDenylist for example) as the banned-list. The wiki-page must be a list with one item per line, and must exist otherwise Special:GlobalRenameRequest will throw a MWException.
    Example: $wgGlobalRenameDenylist = Title::makeTitle( NS_MEDIAWIKI, 'GlobalRenameDenylist' );.
  • Using a URL: put a complete URL which must return, using HTTP, a plain-text list of the banned users (and nothing else).
    For example, with a URL pointing to a wiki page: $wgGlobalRenameDenylist = "https://yourwiki/yourpath/index.php?title=MediaWiki:GlobalRenameDenylist&action=raw";

You can use the exact names or regular expressions.

@var Title|string|null

$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

使用法

単一利用者ログインシステム (SUL) を採用、MediaWiki のAuthPlugin システムを援用。 利用者の作成とログインは単一の統一利用者テーブルを用いて、全てのウィキでグローバルに実行されます。 ローカルの利用者アカウントはいずれにしてもアカウント作成・ログイン時に自動的に作成されることに留意してください。

この拡張機能はまた、グローバルな利用者グループを実行し、そこにはグローバルアカウントを登録できます。

利用者権限

CentralAuth は複数の新しい利用者権限を定義します。

利用者権限 技能 既定のグループ 状態
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.

グローバルユーザーをロックして非表示にする

Meta-Wiki上のSpecial:CentralAuthインターフェイスのスクリーンショットで、ロック/非表示のインターフェイスを表示しています。

グローバル アカウントは、既定で local グループ 'stewards' に与えられている centralauth-lockcentralauth-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 から、もしくは web-based viewer経由でアクセス可能です。

ソフトウェアは現状のまま支給されます。 ウィキメディアのウィキの需要による場合、もしくは重大な脆弱性が発見された場合に更新が行われる可能性があります。

API

Extension:CentralAuth/API を参照

脚注

関連項目