Hello, I am writing an authentication App, that is supposed to replace the authentication of the users and verify the user account against an external two factor authentication server.
I am done with all the configuration stuff and now I am about replacing
the user backend.
Roughly my app.php looks like this (I took a look at user_external,
user_ldap and user_otp):
<?php
\OCP\App::registerAdmin('user_privacyidea', 'adminSettings');
OC::$CLASSPATH['OC_User_PRIVACYIDEA'] =
'apps/user_privacyidea/lib/otp_privacyidea.php';
$enabled = OCP\Config::getAppValue('privacyIDEA','enable_privacyidea');
OCP\Util::writeLog('user_privacyidea', $enabled, OCP\Util::ERROR);
if($enabled === "yes") {
OCP\Util::writeLog('user_privacyidea', 'privacyIDEA is enabled',
OCP\Util::ERROR);
$usedBackends = OC_User::getUsedBackends();
OC_User::clearBackends();
$userBackend = new OC_User_PRIVACYIDEA();
// register user backend
OC_User::useBackend($userBackend);
} else {
OCP\Util::writeLog('user_privacyidea', 'privacyIDEA is disabled',
OCP\Util::ERROR);
}
So far it works fine. The normal local users can not login anymore! ;-)
Nevertheless I get the following error in the log file and wondering,
how I ended up there:
{"reqId":"ddfc040c35abc68350c806acf72e1c57","remoteAddr":"212.185.212.207","app":"handleLogin","message":"Exception:
{\"Message\":\"An exception occurred while executing 'INSERT INTO
`oc_preferences` (`configvalue`,`userid`,`appid`,`configkey`) SELECT ?,?,?,?
FROM `oc_preferences` WHERE `configkey` = ? AND `userid` IS NULL AND `appid` =
? HAVING COUNT(*) = 0' with params [1435154884, null, \\\"login\\\",
\\\"lastLogin\\\", \\\"lastLogin\\\", \\\"login\\\"]:\\n\\nSQLSTATE[23000]:
Integrity constraint violation: 1062 Duplicate entry 'login-lastLogin' for key
'PRIMARY'\",\"Code\":0,\"Trace\":\"#0
\\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(116):
Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException('An
exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1
\\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(996):
Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOMySql\\\\Driver),
Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'INSERT INTO `oc...',
Array)\\n#2
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/connection.php(132):
Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTO `oc...', Array,
Array)\\n#3
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/adapter.php(75):
OC\\\\DB\\\\Connection->executeUpdate('INSERT INTO `*P...', Array)\\n#4
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/connection.php(171):
OC\\\\DB\\\\Adapter->insertIfNotExist('*PREFIX*prefere...', Array, Array)\\n#5
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/allconfig.php(198):
OC\\\\DB\\\\Connection->insertIfNotExist('*PREFIX*prefere...', Array,
Array)\\n#6
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/user\\\/user.php(145):
OC\\\\AllConfig->setUserValue(NULL, 'login', 'lastLogin', 1435154884)\\n#7
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/user\\\/manager.php(57):
OC\\\\User\\\\User->updateLastLoginTimestamp()\\n#8 [internal function]:
OC\\\\User\\\\Manager->OC\\\\User\\\\{closure}(Object(OC\\\\User\\\\User),
'test123!')\\n#9
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/hooks\\\/basicemitter.php(85):
call_user_func_array(Object(Closure), Array)\\n#10
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/hooks\\\/publicemitter.php(18):
OC\\\\Hooks\\\\BasicEmitter->emit('\\\\OC\\\\User', 'postLogin', Array)\\n#11
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/user\\\/session.php(202):
OC\\\\Hooks\\\\PublicEmitter->emit('\\\\OC\\\\User', 'postLogin', Array)\\n#12
\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/user.php(216):
OC\\\\User\\\\Session->login('admin', 'test123!')\\n#13
\\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(991): OC_User::login('admin',
'test123!')\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(887):
OC::tryFormLogin()\\n#15 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(849):
OC::handleLogin()\\n#16 \\\/var\\\/www\\\/owncloud\\\/index.php(36):
OC::handleRequest()\\n#17
{main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":66}","level":4,"time":"2015-06-24T14:08:04+00:00"}
So what is the duplicate with the last log?
Thanks a lot and kind regards
Cornelius
--
Cornelius Kölbel
[email protected]
+49 151 2960 1417
NetKnights GmbH
http://www.netknights.it
Landgraf-Karl-Str. 19, 34131 Kassel, Germany
Tel: +49 561 3166797, Fax: +49 561 3166798
Amtsgericht Kassel, HRB 16405
Geschäftsführer: Cornelius Kölbel
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Devel mailing list [email protected] http://mailman.owncloud.org/mailman/listinfo/devel
