This package implements single sign on authentication for Discourse forum using the Crowd authentication API.
To set up the Discourse single sign on authentication, you must first enable it in the Discourse admin panel. Instructions for enabling the single sign on can be found on the discourse website:
https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045
The sso_url should point to the auth.php in this package. The sso_secret
can be any value you choose, but it must be kept secret and it must be reflected
in the configuration of this single sign on package.
Warning: The authentication script makes a large number of HTTP requests to the Discourse API (especially if it needs to create groups and modify user groups). Unless the server properly configured, the authentication script may fail due to HTTP error 429 (Too Many Requests). This might not be a major problem, however, since it can usually be solved by just trying to log in again.
Before configuring the library, you need to install the library dependencies for the project via composer. Easiest way to do this is to run:
php -r "readfile('https://getcomposer.org/installer');" | php
php composer.phar install
The configuration settings are read from the forum_settings.json file. Make
a copy of the sample file and rename it without the 'sample' suffix. The
settings file contains the following configuration options:
authLogcontains a path that stores authentication logs. The path is path acceptsstrftime()tokens. Set to null to disable logging.groupPrefixis the prefix for group names imported from Crowd.groupMaxLengthis the maximum length of group names (Discourse 1.3 allows up to 20 characters).groupTruncateLengthis the maximum length of a truncated group name.shortGroupNametells whether to use shorter truncated names or longer names that might not be truncated. Optimal settings forgroupMaxLengthandgroupTruncateLengthfortrueare15and8. Forfalse, the optimal values are20and10.ssoSecretmust be set to the same value assso_secretin the admin panel.ssoUrlis the URL path to theauth.phpfile.ssoCallbackUrlis the URL path to the/session/sso_loginurl in Discourse.discourseUrlindicates the base URL to the discourse api.discourseUsernameis the username used by api calls (usually 'system').discourseKeyis the api key for the username.crowdUsernameis the username used to authenticate to the Crowd apicrowdPasswordis the password for the Crowd api usercrowdUrlis the base URL to the crowd apicrowdLoginUrlis the URL to the login page used to login into the Crowd