texthtml/mediawiki-oauth2-auth

There is no license information available for the latest version (v1.0.2) of this package.

Authenticate Mediawiki from external OAuth2 server

Installs: 42

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 1

Type:mediawiki-extension

v1.0.2 2016-11-02 09:50 UTC

This package is auto-updated.

Last update: 2024-04-24 18:40:41 UTC


README

Authenticate Mediawiki users from external OAuth2 server

installation

composer require texthtml/mediawiki-oauth2-auth

// load the extension
\TH\MediaWiki\OAuth2Auth\Extension::load();

// configure the OAuth2 provider
$wgMediaWikiOAuth2Auth['provider.config'] = [
    'clientId'                => 'demoapp',     // The client ID assigned to you by the provider
    'clientSecret'            => 'demopass', // The client password assigned to you by the provider
    'redirectUri'             => 'https://example.com/callback-url',
    'urlAuthorize'            => 'https://auth.dataporten.no/oauth/authorization',
    'urlAccessToken'          => 'https://auth.dataporten.no/oauth/token',
    'urlResourceOwnerDetails' => 'https://auth.dataporten.no/userinfo',
];

// optional: select another OAuth2 provider @see https://github.com/thephpleague/oauth2-client/blob/master/docs/providers/thirdparty.md
$wgMediaWikiOAuth2Auth['provider.class'] = \League\OAuth2\Client\Provider\GenericProvider::class;

// option: or build it manually (without setting $wgMediaWikiOAuth2Auth['provider.config'])
$wgMediaWikiOAuth2Auth['provider'] = new \League\OAuth2\Client\Provider\GenericProvider::class([
    'clientId'                => 'demoapp',     // The client ID assigned to you by the provider
    'clientSecret'            => 'demopass', // The client password assigned to you by the provider
    'redirectUri'             => 'https://example.com/callback-url',
    'urlAuthorize'            => 'https://auth.dataporten.no/oauth/authorization',
    'urlAccessToken'          => 'https://auth.dataporten.no/oauth/token',
    'urlResourceOwnerDetails' => 'https://auth.dataporten.no/userinfo',
]);