mwstake / mediawiki-component-oauth-client
2.0.0
2024-07-17 14:20 UTC
Requires
- ext-sodium: *
- composer/installers: ~1.0|~2
- firebase/php-jwt: ^6.10.0
- league/oauth2-client: 2.6.*
- mwstake/mediawiki-componentloader: ~1
- phpseclib/phpseclib: ~3.0
Requires (Dev)
- jakub-onderka/php-console-highlighter: 0.4.0
- jakub-onderka/php-parallel-lint: 1.0.0
- mediawiki/mediawiki-codesniffer: 29.0.0
- mediawiki/minus-x: 1.0.0
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-09-17 14:35:37 UTC
README
OAuth2协议用户身份验证库。
安装
composer require mwstake/mediawiki-component-oauth-client
用法
连接参数
$GLOBALS['wgOAuthClientConfig'] = [ 'base_uri' => '', 'client_id' => '##CLIENT_ID##', 'client_secret' => '##CLIENT_SECRET##', // if needed adapt endpoints, if not, omit to use the defaults 'endpoints' => [ 'authorize' => '/oauth2/authorize', 'token' => '/oauth2/token', 'user' => '/oauth2/user', ], // if needed adapt scopes, if not, omit to use the defaults 'default_scopes' => [], 'redirect_uri' => ##REDIRECT_URI##, ];
登录页面
您的实现需要提供一个登录页面,该页面将被用作OAuth2授权代码流的重定向目标。
在$GLOBALS['wgOAuthLoginPage'] = 'MyPage
;`中指定SpecialPage的名称。
资源所有者
如果您想有一个自定义资源所有者,实现一个类,该类实现了League\OAuth2\Client\Provider\ResourceOwnerInterface
,并在$GLOBALS['wgOAuthClientResourceOwner'] = MyResourceOwner::class;
中设置它。
否则,将使用默认的League\OAuth2\Client\Provider\GenericResourceOwner
。