Use Discourse SSO with Mantis Bug Tracker

AI-generated summary

SXX shares a step-by-step guide for integrating Discourse SSO with Mantis Bug Tracker 1.2, noting it may work with newer versions pending testing. First, users must enable the SSO provider in Discourse per this guide. Next, install the Discourse SSO client script from GitHub by copying discourse-sso.php into the Mantis directory and configuring it. Visiting https://your.wiki.domain/discourse-sso.php creates the required database table, which can be verified via command line with mysql -u mantisuser -pPASSWORD mantisdb -e "SELECT * FROM sso_login;". Then, install the MantisDiscourseSSO plugin by cloning it into the plugins directory and enabling it through Mantis’s interface. Finally, update config_inc.php with specific settings: set $g_login_method = DISCOURSE_SSO;, disable signup and password reset ($g_allow_signup = OFF;, $g_send_reset_password = OFF;), redirect logout to view_all_bug_page.php, and allow blank emails ($g_allow_blank_email = ON;). SXX invites users to report compatibility with Mantis 1.3 or 2.x for future updates.

Here is the my basic integration for Mantis bug tracker 1.2.
It’s might work with newer versions, but someone has to test it.

Read the instruction and activate SSO provider in Discourse

Install Discourse SSO client script

  1. Get script from GitHub:
    GitHub - ArseniyShestakov/singlefile-discourse-sso-php: Ugly, but working single-file SSO implementation in PHP · GitHub
  2. Copy discourse-sso.php into directory with your wiki.
  3. Edit defines on top of file according to your need.
  4. To create database table and test it visit https://your.wiki.domain/discourse-sso.php

You can check SSO_DB_TABLE contents from command line:

mysql -u mantisuser -pPASSWORD mantisdb -e "SELECT * FROM sso_login;"

If everything is fine you’ll see username / email and other information here.

Install MantisDiscourseSSO plugin

Plugin need to be cloned into plugins directory and installed via Mantis interface.

Edit config_inc.php

Several new options need to be added to

        // Enable login through Discourse SSO plugin
        $g_login_method = DISCOURSE_SSO;
	// Disable signup on Mantis
        $g_allow_signup = OFF;
	// Disable password reset by Mantis
        $g_send_reset_password = OFF;
        // Must be changed since default is login_page.php and that page will redirect to Discourse SSO
        $g_logout_redirect_page = 'view_all_bug_page.php';
        // Users are created by SSO plugin with empty email
        $g_allow_blank_email = ON;

If someone need this working with newer Mantis please post about that here and I’ll try to make it compatible with 1.3 and 2.x since it’s shouldn’t be too hard.

5 Likes