Hello,
I'm trying to configure a MW installation to use AD for authentication. I modified LocalSettings.php and created ldap.json.
I run extensions/LDAPProvider/maintenance/ShowUserInfo.php, ShowUserGroups.php and CheckLogin.php scripts and all three works fine. Therefore at this point I was confident. But...
When I try to login I receive the message "Fatal error authenticating user" and I find three lines like the following in the log file:
ErrorException from line 42 of /var/www/mediawiki-1.34.1/extensions/LDAPAuthentication2/src/PluggableAuth.php: PHP Notice: Trying to access array offset on value of type null
The same for lines 43 and 44. This means that the variable $extraLoginFields is empty. But why? Why it needs extra login fields? Documentation, about $wgPluggableAuth_ExtraLoginFields says "This configuration variable may be set by authentication plugins and should not be set by wiki site administrators".
It happens even if I use a fake username or a wrong password therefore it seems it's not an authentication issue.
I tried with or without LDAPAuthorization and LDAPGroup extensions enabled but the result is the same.
Any suggest?
Best regards
My configuration:
MW: 1.34.1
Php: 7.4.3
LDAPAuthentication2, LDAPAuthorization, LDAPGroups, LDAPProvider, LDAPUserInfo, PluggableAuth: latest version
my LocalSettings.php modifications:
$ldapJsonFile = "$IP/ldap.json";
wfLoadExtension( 'PluggableAuth' );
wfLoadExtension( 'LDAPProvider' );
wfLoadExtension( 'LDAPAuthentication2' );
wfLoadExtension( 'LDAPAuthorization' );
wfLoadExtension( 'LDAPUserInfo' );
wfLoadExtension( 'LDAPGroups' );
$LDAPProviderDomainConfigs = $ldapJsonFile;
$LDAPAuthentication2AllowLocalLogin = false;
$wgPluggableAuth_ButtonLabel = "Log In";
my ldap.json:
{
"MY.DOMAIN": {
"connection": {
"server": "adserver.ip.domain",
"user": "aduser",
"pass": "pass",
"options": {
"LDAP_OPT_DEREF": 1
},
"port": "636",
"enctype": "ssl",
"basedn": "DC=my,DC=domain",
"userbasedn": "OU=Users,OU=organization,DC=my,DC=domain",
"groupbasedn": "OU=Groups,OU=organization,DC=my,DC=domain",
"grouprequest": "MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\UserMemberOf::factory",
"searchattribute": "sAMAccountName",
"usernameattribute": "sAMAccountName",
"realnameattribute": "cn",
"emailattribute": "mail",
"presearchusernamemodifiers": [ "spacestounderscores", "lowercase" ]
},
"userinfo": [],
"groupsync": []
}
}