xperseguers / t3ext-ig_ldap_sso_auth

TYPO3 Extension ig_ldap_sso_auth. This extension provides LDAP and SSO support for TYPO3.
https://extensions.typo3.org/extension/ig_ldap_sso_auth
27 stars 64 forks source link

Since 3.4.0 neither importing nor auto creating of FE users from AD doesn't work #80

Closed wolf9k closed 2 years ago

wolf9k commented 4 years ago

Typo3 8.7.29, PHP 7.2.5. Fe login attempt ends up with "Oops, an error occurred!" page. Individual import from BE module does nothing. Also nothing appears in logs. Downgrading to version 3.3.1 is the only solution that seems to work.

wolf9k commented 4 years ago

Sorry, maybe more info. Previously created users authenticate OK. Also manually created users with proper username authenticate OK. I didn't try this with BE users because we never create BE users this way.

albig commented 4 years ago

Could you try the current master? I did a patch to solve an issue with Active Directory with version 3.5.0. Maybe it's the same issue?

wolf9k commented 4 years ago

Sorry, did not help. Of course I tried 3.5.0 from extension repository before and also current master from github right now. Still the same issue.

albig commented 4 years ago

Ok. Haven't tried the FE login (we currently have no usecase for it). Could you please configure your system to get the full error message? E.g. use the Configuration Presets in the Install-tool and set it to "Debug".

wolf9k commented 4 years ago

Good point. It is much clearer now: Uncaught TYPO3 Exception An exception occurred while executing 'INSERT INTO fe_users (tx_extbase_type, pid, tstamp, username, password, usergroup, disable, starttime, endtime, name, first_name, middle_name, last_name, address, telephone, fax, email, crdate, cruser_id, lockToDomain, deleted, uc, title, zip, city, country, www, company, image, TSconfig, lastlogin, is_online, felogin_redirectPid, felogin_forgotHash, tx_cal_calendar, tx_cal_calendar_subscription, downloads, tx_igldapssoauth_dn, tx_igldapssoauth_id, description) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [0, 3172, 1574442711, "v....d", "", null, "0", 0, 0, "", "", "", "", "", "", "", "", 1574442711, 0, "", "0", null, "", "", "", "", "", "", null, null, 0, "0", null, "", null, null, "0", "CN=......DC=cz", "0", null]: Column 'tx_cal_calendar' cannot be null Doctrine\DBAL\Exception\NotNullConstraintViolationException thrown in file /......./typo3_src-8.7.29/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php in line 112. Sorry, dots instead of real data.

xperseguers commented 4 years ago

Related to another extension but basically you should configure your MySQL connection with a initDB settings to NOT use strict mode. This should help... a lot ;-)

wolf9k commented 4 years ago

Relation to cal is obvious, but why it isn't problem in version 3.3.1 ?

xperseguers commented 4 years ago

On mobile so not easy to check and long time since 3.3 so out of my mind, either due to the switch to Doctrine to be compatible with modern TYPO3 and/or a change on your side like an upgrade of your MySQL server where strict mode is now on by default.

wolf9k commented 4 years ago

Well, it is not that case, production system runs on the same servers as the copy I'm testing it now and it runs with 3.3.1 right now.

xperseguers commented 4 years ago

Related to #84?

nchiapol commented 4 years ago

I just hit the same problem [1]: after upgrading from 3.3.1 to 3.5.1 auto creating FE users on login does not work anymore.

[1] at least I assume it's the same problem as I do have the same symptoms

Investigating I found that actually importing them works, but lockToDomain (and several other fields) are set to the value '' instead of an empty. As a result the new user exist, but can not login as they do not belong to domain ''.

I then pulled the git repo of the extension and bisected the problem. The first bad commit is

86fe8b0c5a48535ae5bec1fd078373e30ec3d7b3 [TASK] Make the search wizard work again

Specifically, reverting the changes to Classes/Domain/Repository/Typo3UserRepository.php in that commit fixes that commit.

At 3.5.1, getDatabaseConnection() seems to be gone, so reverting the change is not an option. Instead an ugly fix is to add

       // get rid of strange defaults
       foreach ($newUser as $field => $value) {
           if ($newUser[$field] == "''") {
                unset($newUser[$field]);
            }
       }

before

        // uid is a primary key, it should not be specified at all
        unset($newUser['uid']);
nchiapol commented 4 years ago

Rereading this thread I am not so sure it's the same problem. the same auto-creating FE users does not work as expected while previously created users and manually created users with proper username authenticate OK.

different

xperseguers commented 3 years ago

@nchiapol Is your ugly hack still needed?

When I manually call Typo3UserRepository::create('fe_users'); and debug, I don't see any "double-single quote" value and uid column is set to null.

Would help if you could debug and tell which column(s) get(s) those double single quote, so that we can further debug. Since those values are possibly read from TCA default value OR from the database definition, it would be helpful to understand the actual origin.

nchiapol commented 3 years ago

I finally found the time to test on a recent fresh install. In Typo3 v10.4.16 and ig_ldap v3.6.0 things seem to work as expected. So I do not think it is worth debugging this for an old version. (I'll get back to this issue should the problem resurface in one of my existing installations.)