Jump to content

Manual:$wgPasswordConfig

From mediawiki.org
This page is a translated version of the page Manual:$wgPasswordConfig and the translation is 100% complete.
認証: $wgPasswordConfig
内蔵のパスワードの種類についての構成設定。
導入されたバージョン:1.24.0 (Gerrit change 77645; git #95a8974c)
除去されたバージョン:使用中
許容される値:(配列)
既定値:下記参照

詳細

内蔵のパスワードの種類についての構成設定です。

パスワードの種類をオプションの配列にマッピングします:

  • class - 使用する Password クラス。
  • factory (1.40 で導入) - 適切な Password オブジェクトを作成して返す関数です。 このオプションは内部使用のみを目的としており、関数シグネチャは不安定で、将来のバージョンで変更される可能性があります。

他のオプションは、すべてクラス依存です。

既定

MediaWiki バージョン:
1.43
$wgPasswordConfig = [
	'A' => [
		'class' => MWOldPassword::class,
	],
	'B' => [
		'class' => MWSaltedPassword::class,
	],
	'pbkdf2-legacyA' => [
		'class' => LayeredParameterizedPassword::class,
		'types' => [
			'A',
			'pbkdf2',
		],
	],
	'pbkdf2-legacyB' => [
		'class' => LayeredParameterizedPassword::class,
		'types' => [
			'B',
			'pbkdf2',
		],
	],
	'bcrypt' => [
		'class' => BcryptPassword::class,
		'cost' => 9,
	],
	'pbkdf2' => [
		'class' => Pbkdf2PasswordUsingOpenSSL::class,
		'algo' => 'sha512',
		'cost' => '30000',
		'length' => '64',
	],
	'argon2' => [	// 1.33+
		'class' => Argon2Password::class,

		// Algorithm used:
		// * 'argon2i' is optimized against side-channel attacks (PHP 7.2+)
		// * 'argon2id' is optimized against both side-channel and GPU cracking (PHP 7.3+)
		// * 'auto' to use the best available algorithm. If you're using more than one server, be
		//   careful when you're mixing PHP versions because newer PHP might generate hashes that
		//   older versions would not understand.
		'algo' => 'auto',

		// The parameters below are the same as options accepted by password_hash().
		// Set them to override that function's defaults.
		//
		// 'memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST,
		// 'time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST,
		// 'threads' => PASSWORD_ARGON2_DEFAULT_THREADS,
	],
];
MediaWiki バージョン:
1.40 – 1.42
$wgPasswordConfig = [
	'A' => [
		'class' => MWOldPassword::class,
	],
	'B' => [
		'class' => MWSaltedPassword::class,
	],
	'pbkdf2-legacyA' => [
		'class' => LayeredParameterizedPassword::class,
		'types' => [
			'A',
			'pbkdf2',
		],
	],
	'pbkdf2-legacyB' => [
		'class' => LayeredParameterizedPassword::class,
		'types' => [
			'B',
			'pbkdf2',
		],
	],
	'bcrypt' => [
		'class' => BcryptPassword::class,
		'cost' => 9,
	],
	'pbkdf2' => [
		'factory' => [ AbstractPbkdf2Password::class, 'newInstance' ],
		'algo' => 'sha512',
		'cost' => '30000',
		'length' => '64',
	],
	'argon2' => [	// 1.33+
		'class' => Argon2Password::class,

		// Algorithm used:
		// * 'argon2i' is optimized against side-channel attacks (PHP 7.2+)
		// * 'argon2id' is optimized against both side-channel and GPU cracking (PHP 7.3+)
		// * 'auto' to use the best available algorithm. If you're using more than one server, be
		//   careful when you're mixing PHP versions because newer PHP might generate hashes that
		//   older versions would not understand.
		'algo' => 'auto',

		// The parameters below are the same as options accepted by password_hash().
		// Set them to override that function's defaults.
		//
		// 'memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST,
		// 'time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST,
		// 'threads' => PASSWORD_ARGON2_DEFAULT_THREADS,
	],
];
MediaWiki バージョン:
1.33 – 1.39
$wgPasswordConfig = [
	'A' => [
		'class' => MWOldPassword::class,
	],
	'B' => [
		'class' => MWSaltedPassword::class,
	],
	'pbkdf2-legacyA' => [
		'class' => LayeredParameterizedPassword::class,
		'types' => [
			'A',
			'pbkdf2',
		],
	],
	'pbkdf2-legacyB' => [
		'class' => LayeredParameterizedPassword::class,
		'types' => [
			'B',
			'pbkdf2',
		],
	],
	'bcrypt' => [
		'class' => BcryptPassword::class,
		'cost' => 9,
	],
	'pbkdf2' => [
		'class' => Pbkdf2Password::class,
		'algo' => 'sha512',
		'cost' => '30000',
		'length' => '64',
	],
	'argon2' => [	// 1.33+
		'class' => Argon2Password::class,

		// Algorithm used:
		// * 'argon2i' is optimized against side-channel attacks (PHP 7.2+)
		// * 'argon2id' is optimized against both side-channel and GPU cracking (PHP 7.3+)
		// * 'auto' to use the best available algorithm. If you're using more than one server, be
		//   careful when you're mixing PHP versions because newer PHP might generate hashes that
		//   older versions would not understand.
		'algo' => 'auto',

		// The parameters below are the same as options accepted by password_hash().
		// Set them to override that function's defaults.
		//
		// 'memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST,
		// 'time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST,
		// 'threads' => PASSWORD_ARGON2_DEFAULT_THREADS,
	],
];
MediaWiki バージョン:
1.31 – 1.32
$wgPasswordConfig = [
	'A' => [
		'class' => MWOldPassword::class,
	],
	'B' => [
		'class' => MWSaltedPassword::class,
	],
	'pbkdf2-legacyA' => [
		'class' => LayeredParameterizedPassword::class,
		'types' => [
			'A',
			'pbkdf2',
		],
	],
	'pbkdf2-legacyB' => [
		'class' => LayeredParameterizedPassword::class,
		'types' => [
			'B',
			'pbkdf2',
		],
	],
	'bcrypt' => [
		'class' => BcryptPassword::class,
		'cost' => 9,
	],
	'pbkdf2' => [
		'class' => Pbkdf2Password::class,
		'algo' => 'sha512',
		'cost' => '30000',
		'length' => '64',
	],
];
MediaWiki バージョン:
1.24 – 1.30
$wgPasswordConfig = [
	'A' => [
		'class' => 'MWOldPassword',
	],
	'B' => [
		'class' => 'MWSaltedPassword',
	],
	'pbkdf2-legacyA' => [
		'class' => 'LayeredParameterizedPassword',
		'types' => [
			'A',
			'pbkdf2',
		],
	],
	'pbkdf2-legacyB' => [
		'class' => 'LayeredParameterizedPassword',
		'types' => [
			'B',
			'pbkdf2',
		],
	],
	'bcrypt' => [
		'class' => 'BcryptPassword',
		'cost' => 9,
	],
	'pbkdf2' => [
		'class' => 'Pbkdf2Password',
		'algo' => 'sha512',
		'cost' => '30000',
		'length' => '64',
	],
];

以下の例は、LocalSettings.php ファイルに利用者定義のパスワード暗号化を追加する方法を示しています:

$wgPasswordConfig['bcrypt-peppered'] = [
    'class' => 'EncryptedPassword',
    'underlying' => 'bcrypt',
    'secrets' => array(),
    'cipher' => MCRYPT_RIJNDAEL_256,
    'mode' => MCRYPT_MODE_CBC,
    'cost' => 5,
];

関連項目