| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Auth\Hook; |
| 4 | |
| 5 | use MediaWiki\MainConfigSchema; |
| 6 | |
| 7 | /** |
| 8 | * This is a hook handler interface, see docs/Hooks.md. |
| 9 | * Use the hook name "AuthManagerFilterProviders" to register handlers implementing this interface. |
| 10 | * |
| 11 | * @stable to implement |
| 12 | * @ingroup Hooks |
| 13 | */ |
| 14 | interface AuthManagerFilterProvidersHook { |
| 15 | |
| 16 | /** |
| 17 | * Filter the list of authentication available providers. Providers removed from the |
| 18 | * list will be disabled for the current request, and any authentication process started |
| 19 | * from the current request. |
| 20 | * |
| 21 | * Hook handlers don't have to always return the same result for the given configuration |
| 22 | * (can depend on the request, e.g. feature flags) but they do have to be consistent |
| 23 | * within an authentication process that spans multiple requests. |
| 24 | * |
| 25 | * @since 1.43 |
| 26 | * |
| 27 | * @param bool[][] &$providers An array with three sub-arrays: 'preauth', 'primaryauth', |
| 28 | * 'secondaryauth'. Each field in the subarrays is a map of <provider key> => true. |
| 29 | * (The provider key is the same array key that's used in $wgAuthManagerAutoConfig or |
| 30 | * $wgAuthManagerConfig). Unsetting a field or setting its value to falsy disables the |
| 31 | * corresponding provider. |
| 32 | * @phpcs:ignore Generic.Files.LineLength.TooLong |
| 33 | * @phan-param array{preauth:array<string,true>,primaryauth:array<string,true>,secondaryauth:array<string,true>} $providers |
| 34 | * @return void This hook must not abort, it must return no value |
| 35 | * |
| 36 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/AuthManagerFilterProviders |
| 37 | * @see MainConfigSchema::AuthManagerAutoConfig |
| 38 | */ |
| 39 | public function onAuthManagerFilterProviders( array &$providers ): void; |
| 40 | |
| 41 | } |