Skip to content

Commit

Permalink
Don't use samlLocalSettings anymore, rather, use PluggableAuth and Si…
Browse files Browse the repository at this point in the history
…mpleSAMLphp
  • Loading branch information
ndc-rkevans committed Sep 6, 2023
1 parent d0d5166 commit 3ea70e6
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions src/roles/mediawiki/templates/LocalSettings.php.j2
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,39 @@ else {
* Perform authentication up front, immediately after $wikiId is setup.
*
**/
require "{{ m_deploy }}/samlLocalSettings.php";
{% endif %}
## This is commented out because we are no longer using Extension:SimpleSamlAuth
## Instead we will be using Extension:PluggableAuth with Extension:SimpleSamlphp
## which is configued as by the user in MezaLocalExtensions.yml
#require "{{ m_deploy }}/samlLocalSettings.php";


if ( in_array( $wikiId, array( 'mywiki1','mywiki2', ) ) )
{
# Skip "PluggableAuth" AND "SimpleSAMLphp" so that localhost bots can access the wikis
} else {

wfLoadExtension( "PluggableAuth" );
$wgPluggableAuth_EnableAutoLogin = true;

if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip_address = $_SERVER['HTTP_CLIENT_IP']; }
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR']; }
elseif (isset($_SERVER['REMOTE_ADDR'] ) ) { $ip_address = $_SERVER['REMOTE_ADDR']; }

if (isset($ip_address) && $ip_address == '127.0.0.1') { $wgPluggableAuth_EnableLocalLogin = true; }
else { $wgPluggableAuth_EnableLocalLogin = false; }

$wgPluggableAuth_EnableLocalProperties = false;
$wgPluggableAuth_ButtonLabel = 'Click Here for Auto-Logon';

wfLoadExtension( "SimpleSAMLphp" );
$wgSimpleSAMLphp_InstallDir = '/opt/simplesamlphp';
$wgSimpleSAMLphp_AuthSourceId = 'default-sp';
$wgSimpleSAMLphp_UsernameAttribute = 'AUID';
$wgSimpleSAMLphp_RealNameAttribute = 'displayName';
$wgSimpleSAMLphp_EmailAttribute = 'Email';
$wgGroupPermissions['*']['autocreateaccount'] = true;
}
{% endif %}

{% if wiki_id_redirects is defined and wiki_id_redirects|length > 0 %}

Expand Down

0 comments on commit 3ea70e6

Please sign in to comment.