Extension:OAuth2Dataporten

From MediaWiki.org
Jump to navigation Jump to search


MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg
OAuth2Dataporten

Release status:Extension status stable

DescriptionTemplate:Extension#description Dataporten OAuth2 extension
Author(s)Template:Extension#username (KasperRTtalk)
LicenseTemplate:Extension#license MIT License
Download https://github.com/kasperrt/MediaWiki-OAuth2-Dataporten
Hooks usedTemplate:Extension#hook
UserLogoutManual:Hooks/UserLogout
UserLoginFormManual:Hooks/UserLoginForm
BeforePageDisplayManual:Hooks/BeforePageDisplay
LoadExtensionSchemaUpdatesManual:Hooks/LoadExtensionSchemaUpdates

Translate the OAuth2Dataporten extension if it is available at translatewiki.net

Check usage and version matrix.

The OAuth2Dataporten extension does foo.

Installation[edit]

  • Download and place the file(s) in a directory called OAuth2Dataporten in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/OAuth2Dataporten/OAuth2Dataporten.php";
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration parameters[edit]

$wgOAuth2Dataporten['client']['id'] = getenv('DATAPORTEN_CLIENTID') ? getenv('DATAPORTEN_CLIENTID') : ;

$wgOAuth2Dataporten['client']['secret'] = getenv('DATAPORTEN_CLIENTSECRET') ? getenv('DATAPORTEN_CLIENTSECRET') : ; Client secret

$wgOAuth2Dataporten['config']['groups_array'] = getenv('DATAPORTEN_RIGHTS_ARRAY') ? json_decode(getenv('DATAPORTEN_RIGHTS_ARRAY'),true) : array(); Dataporten groups with their respective roles on mediawiki

$wgOAuth2Dataporten['config']['auth_endpoint'] = 'https://auth.dataporten.no/oauth/authorization'; urls of authorization, token and info

$wgOAuth2Dataporten['config']['token_endpoint'] = 'https://auth.dataporten.no/oauth/token';

$wgOAuth2Dataporten['config']['info_endpoint'] = 'https://auth.dataporten.no/userinfo';

$wgOAuth2Dataporten['config']['auth_type'] = 'Bearer';

$wgOAuth2Dataporten['config']['group_endpoint'] = 'https://groups-api.dataporten.no/groups/me/groups';

$wgGroupPermissions['group']['right'] = true /* or false */;

$wgGroupPermissions['oauth2'] = $wgGroupPermissions['user'];