Skip to content

triauth for MediaWikiOIDC

Let your team sign in to your wiki with one approval on their own device, through the OpenID Connect extension.

  • Wiki and docs
  • Open source
Sign-in through
OpenID Connect bridge
Available in
MediaWiki 1.42 and newer, with the PluggableAuth and OpenID Connect extensions
Set up in
LocalSettings.php

About MediaWiki

MediaWiki is the wiki software that runs Wikipedia. Organizations use it for internal knowledge bases, documentation, and intranet wikis.

Connect MediaWiki to triauth

MediaWiki signs people in through the triauth OpenID Connect bridge, with two extensions: PluggableAuth, the login framework, and OpenID Connect, the protocol plugin. Once connected, the wiki's login page shows a button carrying your domain's name. People on your team click it, type their username, and approve on their own device. Nobody keeps a wiki password, and when someone leaves, removing their identity records at your domain ends their access to the wiki as well.

How it works

  1. Install the PluggableAuth and OpenID Connect extensions into your wiki's extensions folder, as their pages describe.

  2. Open oidc.triauth.org and enter your domain. Paste the wiki's redirect address, the full address of its Special:PluggableAuthLogin page, such as https://wiki.example.com/index.php/Special:PluggableAuthLogin, and click Connect app. The bridge gives you a client ID and a client secret.

  3. Add the lines below to LocalSettings.php. Replace example.com with your domain and the two placeholders with the client ID and the client secret from the bridge.

    php
    wfLoadExtension( 'PluggableAuth' );
    wfLoadExtension( 'OpenIDConnect' );
    $wgPluggableAuth_Config['example.com'] = [
        'plugin' => 'OpenIDConnect',
        'data' => [
            'providerURL' => 'https://oidc.triauth.org/example.com',
            'clientID' => '<client ID from the bridge>',
            'clientsecret' => '<client secret from the bridge>',
            'scope' => [ 'openid', 'profile', 'email', 'groups' ],
        ],
    ];
    $wgGroupPermissions['*']['autocreateaccount'] = true;
  4. Open the wiki's login page and click the button with your domain's name.

Checkpoint

The wiki's login page shows a button with your domain's name. Choosing it opens a page from the bridge that asks for the username, and the person's authenticator asks them to approve.

Good to know

  • Everyone with an identity at your domain gets a wiki account the first time they sign in, named after their username, such as John for john@example.com. To let only one team in, limit the app to a group when you connect it.
  • With a groupsyncs entry in the configuration, the wiki's user groups follow the groups published at your domain.
  • $wgPluggableAuth_EnableAutoLogin sends visitors straight to the bridge, and $wgPluggableAuth_EnableLocalLogin keeps or hides the password form.

For the person who connects the app

SettingValue
Redirect addressthe full address of Special:PluggableAuthLogin, which depends on your wiki's URL scheme and language
Where in MediaWikiLocalSettings.php, after the two wfLoadExtension lines
Provider URLhttps://oidc.triauth.org/<your domain>, from which the extension reads the rest
Usernamesfrom preferred_username, the default, the person's username. $wgOpenIDConnect_UseRealNameAsUserName takes it from the name claim instead
Groups'groupsyncs' => [ [ 'type' => 'syncall' ] ] in the configuration, which reads the groups claim
PKCEoptional, 'codeChallengeMethod' => 'S256'

The extension keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. The OpenID Connect extension page and the PluggableAuth page explain every setting.

Next steps

All logos and trademarks belong to their respective owners and do not imply affiliation or endorsement of the organization or product by triauth, nor vice versa. The content provided on this page may include information from third-party sources. We do not assume any responsibility for the completeness, correctness, or applicability of the information. You should independently verify any details before relying on them.