Authenticator code cleanup as per review
authorBen Rosser <rosser.bjr@gmail.com>
Fri, 9 Sep 2016 05:27:27 +0000 (01:27 -0400)
committerBen Rosser <rosser.bjr@gmail.com>
Sat, 27 May 2017 18:01:06 +0000 (14:01 -0400)
* Standardized on "authenticator" rather than "authBackend"
* Removed XXXs and replaced with TODO or FIXME comments appropriately
* Fixed a couple whitespace errors
* Cleared up some comments in the ldap cmake
* In the authenticator code, renamed displayName to backendId
* Added missing newline at the end of authenticator.cpp

23 files changed:
CMakeLists.txt
cmake/FindLdap.cmake
src/client/clientauthhandler.cpp
src/client/clientauthhandler.h
src/client/coreconnection.h
src/common/main.cpp
src/common/protocol.h
src/common/protocols/datastream/datastreampeer.cpp
src/common/protocols/legacy/legacypeer.cpp
src/common/quassel.h
src/core/authenticator.cpp
src/core/authenticator.h
src/core/core.cpp
src/core/core.h
src/core/coreauthhandler.cpp
src/core/ldapauthenticator.cpp
src/core/ldapauthenticator.h
src/core/sqlauthenticator.cpp
src/core/sqlauthenticator.h
src/qtui/coreconfigwizard.cpp
src/qtui/coreconfigwizard.h
src/qtui/mainwin.cpp
src/qtui/ui/coreconfigwizardsyncpage.ui

index bf56d71..d527ee6 100644 (file)
@@ -133,7 +133,8 @@ if (LINK_EXTRA)
 endif()
 
 
 endif()
 
 
-# LDAP Authentication (and other authentication backends).
+# List of authenticators and the cmake flags to build them
+# (currently that's just LDAP, but more can be added here).
 ####################################################################
 option(WITH_LDAP     "Enable LDAP authentication support if present on system"  ON)
 
 ####################################################################
 option(WITH_LDAP     "Enable LDAP authentication support if present on system"  ON)
 
index 2f0c0dd..5532547 100644 (file)
@@ -13,16 +13,17 @@ if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
     set(Ldap_FIND_QUIETLY TRUE)
 endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
 
     set(Ldap_FIND_QUIETLY TRUE)
 endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
 
-#if(UNIX)
 # Attempt to link against ldap.h regardless of platform!
 FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
 FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
 FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
 
 # Attempt to link against ldap.h regardless of platform!
 FIND_PATH(LDAP_INCLUDE_DIR ldap.h)
 FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap)
 FIND_LIBRARY(LBER_LIBRARIES NAMES lber)
 
-#else(UNIX)
+# It'd be nice to link against winldap on Windows, unfortunately
+# the interfaces are different. In theory a compatibility shim
+# could be written; if someone ever gets around to doing that these
+# lines should be uncommented and used on Windows.
 #   FIND_PATH(LDAP_INCLUDE_DIR winldap.h)
 #   FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32)
 #   FIND_PATH(LDAP_INCLUDE_DIR winldap.h)
 #   FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32)
-#endif(UNIX)
 
 if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
    set(LDAP_FOUND TRUE)
 
 if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
    set(LDAP_FOUND TRUE)
index 7ded71d..4a99890 100644 (file)
@@ -303,7 +303,7 @@ void ClientAuthHandler::handle(const ClientRegistered &msg)
 {
     _coreConfigured = msg.coreConfigured;
     _backendInfo = msg.backendInfo;
 {
     _coreConfigured = msg.coreConfigured;
     _backendInfo = msg.backendInfo;
-    _authBackendInfo = msg.authBackendInfo;
+    _authenticatorInfo = msg.authenticatorInfo;
 
     Client::setCoreFeatures(static_cast<Quassel::Features>(msg.coreFeatures));
 
 
     Client::setCoreFeatures(static_cast<Quassel::Features>(msg.coreFeatures));
 
@@ -322,7 +322,7 @@ void ClientAuthHandler::onConnectionReady()
 
     if (!_coreConfigured) {
         // start wizard
 
     if (!_coreConfigured) {
         // start wizard
-        emit startCoreSetup(_backendInfo, _authBackendInfo);
+        emit startCoreSetup(_backendInfo, _authenticatorInfo);
     }
     else // TODO: check if we need LoginEnabled
         login();
     }
     else // TODO: check if we need LoginEnabled
         login();
index d6e54cd..5ebd530 100644 (file)
@@ -70,7 +70,7 @@ signals:
 #endif
 
     void encrypted(bool isEncrypted = true);
 #endif
 
     void encrypted(bool isEncrypted = true);
-    void startCoreSetup(const QVariantList &backendInfo, const QVariantList &authBackendInfo);
+    void startCoreSetup(const QVariantList &backendInfo, const QVariantList &authenticatorInfo);
     void coreSetupSuccessful();
     void coreSetupFailed(const QString &error);
 
     void coreSetupSuccessful();
     void coreSetupFailed(const QString &error);
 
@@ -113,7 +113,7 @@ private:
     RemotePeer *_peer;
     bool _coreConfigured;
     QVariantList _backendInfo;
     RemotePeer *_peer;
     bool _coreConfigured;
     QVariantList _backendInfo;
-    QVariantList _authBackendInfo;
+    QVariantList _authenticatorInfo;
     CoreAccount _account;
     bool _probing;
     bool _legacy;
     CoreAccount _account;
     bool _probing;
     bool _legacy;
index f381c33..4a1766e 100644 (file)
@@ -97,7 +97,7 @@ signals:
     void progressValueChanged(int value);
     void progressTextChanged(const QString &);
 
     void progressValueChanged(int value);
     void progressTextChanged(const QString &);
 
-    void startCoreSetup(const QVariantList &backendInfo, const QVariantList &authBackendInfo);
+    void startCoreSetup(const QVariantList &backendInfo, const QVariantList &authenticatorInfo);
     void coreSetupSuccess();
     void coreSetupFailed(const QString &error);
 
     void coreSetupSuccess();
     void coreSetupFailed(const QString &error);
 
index 0441f2c..71579df 100644 (file)
@@ -163,7 +163,7 @@ int main(int argc, char **argv)
 #endif
     cliParser->addOption("logfile", 'l', "Log to a file", "path");
     cliParser->addOption("select-backend", 0, "Switch storage backend (migrating data if possible)", "backendidentifier");
 #endif
     cliParser->addOption("logfile", 'l', "Log to a file", "path");
     cliParser->addOption("select-backend", 0, "Switch storage backend (migrating data if possible)", "backendidentifier");
-       cliParser->addOption("select-authenticator", 0, "Switch auth backend", "authidentifier");
+    cliParser->addOption("select-authenticator", 0, "Select authentication backend", "authidentifier");
     cliParser->addSwitch("add-user", 0, "Starts an interactive session to add a new core user");
     cliParser->addOption("change-userpass", 0, "Starts an interactive session to change the password of the user identified by <username>", "username");
     cliParser->addSwitch("oidentd", 0, "Enable oidentd integration");
     cliParser->addSwitch("add-user", 0, "Starts an interactive session to add a new core user");
     cliParser->addOption("change-userpass", 0, "Starts an interactive session to change the password of the user identified by <username>", "username");
     cliParser->addSwitch("oidentd", 0, "Enable oidentd integration");
index d9d1049..f3c18e4 100644 (file)
@@ -81,20 +81,20 @@ struct ClientDenied : public HandshakeMessage
 
 struct ClientRegistered : public HandshakeMessage
 {
 
 struct ClientRegistered : public HandshakeMessage
 {
-    inline ClientRegistered(quint32 coreFeatures, bool coreConfigured, const QVariantList &backendInfo, bool sslSupported, const QVariantList &authBackendInfo)
+    inline ClientRegistered(quint32 coreFeatures, bool coreConfigured, const QVariantList &backendInfo, bool sslSupported, const QVariantList &authenticatorInfo)
     : coreFeatures(coreFeatures)
     , coreConfigured(coreConfigured)
     , backendInfo(backendInfo)
     : coreFeatures(coreFeatures)
     , coreConfigured(coreConfigured)
     , backendInfo(backendInfo)
-    , authBackendInfo(authBackendInfo)
+    , authenticatorInfo(authenticatorInfo)
     , sslSupported(sslSupported)
     {}
 
     quint32 coreFeatures;
     bool coreConfigured;
 
     , sslSupported(sslSupported)
     {}
 
     quint32 coreFeatures;
     bool coreConfigured;
 
-    // The authBackendInfo should be optional!
+    // The authenticatorInfo should be optional!
     QVariantList backendInfo; // TODO: abstract this better
     QVariantList backendInfo; // TODO: abstract this better
-    QVariantList authBackendInfo;
+    QVariantList authenticatorInfo;
 
     // this is only used by the LegacyProtocol in compat mode
     bool sslSupported;
 
     // this is only used by the LegacyProtocol in compat mode
     bool sslSupported;
index acf7a42..6a21a16 100644 (file)
@@ -124,12 +124,12 @@ void DataStreamPeer::handleHandshakeMessage(const QVariantList &mapData)
     }
 
     else if (msgType == "ClientInitAck") {
     }
 
     else if (msgType == "ClientInitAck") {
-        handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), false, m["AuthBackends"].toList())); // SupportsSsl  obsolete
+        handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), false, m["Authenticators"].toList())); // SupportsSsl obsolete
     }
 
     else if (msgType == "CoreSetupData") {
         QVariantMap map = m["SetupData"].toMap();
     }
 
     else if (msgType == "CoreSetupData") {
         QVariantMap map = m["SetupData"].toMap();
-        handle(SetupData(map["AdminUser"].toString(), map["AdminPasswd"].toString(), map["Backend"].toString(), map["ConnectionProperties"].toMap(), map["AuthBackend"].toString(), map["AuthProperties"].toMap()));
+        handle(SetupData(map["AdminUser"].toString(), map["AdminPasswd"].toString(), map["Backend"].toString(), map["ConnectionProperties"].toMap(), map["Authenticator"].toString(), map["AuthProperties"].toMap()));
     }
 
     else if (msgType == "CoreSetupReject") {
     }
 
     else if (msgType == "CoreSetupReject") {
@@ -187,7 +187,7 @@ void DataStreamPeer::dispatch(const ClientRegistered &msg) {
     m["MsgType"] = "ClientInitAck";
     m["CoreFeatures"] = msg.coreFeatures;
     m["StorageBackends"] = msg.backendInfo;
     m["MsgType"] = "ClientInitAck";
     m["CoreFeatures"] = msg.coreFeatures;
     m["StorageBackends"] = msg.backendInfo;
-    m["AuthBackends"] = msg.authBackendInfo;
+    m["Authenticators"] = msg.authenticatorInfo;
     m["LoginEnabled"] = m["Configured"] = msg.coreConfigured;
 
     writeMessage(m);
     m["LoginEnabled"] = m["Configured"] = msg.coreConfigured;
 
     writeMessage(m);
@@ -203,8 +203,7 @@ void DataStreamPeer::dispatch(const SetupData &msg)
     map["ConnectionProperties"] = msg.setupData;
 
     // Auth backend properties.
     map["ConnectionProperties"] = msg.setupData;
 
     // Auth backend properties.
-    // XXX: make these optional using core features.
-    map["AuthBackend"] = msg.authenticator;
+    map["Authenticator"] = msg.authenticator;
     map["AuthProperties"] = msg.authSetupData;
 
     QVariantMap m;
     map["AuthProperties"] = msg.authSetupData;
 
     QVariantMap m;
index a0afebd..f59dffa 100644 (file)
@@ -170,12 +170,12 @@ void LegacyPeer::handleHandshakeMessage(const QVariant &msg)
             socket()->setProperty("UseCompression", true);
 #endif
 
             socket()->setProperty("UseCompression", true);
 #endif
 
-        handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), m["SupportSsl"].toBool(), m["AuthBackends"].toList()));
+        handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), m["SupportSsl"].toBool(), m["Authenticators"].toList()));
     }
 
     else if (msgType == "CoreSetupData") {
         QVariantMap map = m["SetupData"].toMap();
     }
 
     else if (msgType == "CoreSetupData") {
         QVariantMap map = m["SetupData"].toMap();
-        handle(SetupData(map["AdminUser"].toString(), map["AdminPasswd"].toString(), map["Backend"].toString(), map["ConnectionProperties"].toMap(), map["AuthBackend"].toString(), map["AuthProperties"].toMap()));
+        handle(SetupData(map["AdminUser"].toString(), map["AdminPasswd"].toString(), map["Backend"].toString(), map["ConnectionProperties"].toMap(), map["Authenticator"].toString(), map["AuthProperties"].toMap()));
     }
 
     else if (msgType == "CoreSetupReject") {
     }
 
     else if (msgType == "CoreSetupReject") {
@@ -242,7 +242,7 @@ void LegacyPeer::dispatch(const ClientRegistered &msg) {
     m["MsgType"] = "ClientInitAck";
     m["CoreFeatures"] = msg.coreFeatures;
     m["StorageBackends"] = msg.backendInfo;
     m["MsgType"] = "ClientInitAck";
     m["CoreFeatures"] = msg.coreFeatures;
     m["StorageBackends"] = msg.backendInfo;
-    m["AuthBackends"] = msg.authBackendInfo;
+    m["Authenticators"] = msg.authenticatorInfo;
 
     // FIXME only in compat mode
     m["ProtocolVersion"] = protocolVersion;
 
     // FIXME only in compat mode
     m["ProtocolVersion"] = protocolVersion;
@@ -265,10 +265,9 @@ void LegacyPeer::dispatch(const SetupData &msg)
     map["AdminPasswd"] = msg.adminPassword;
     map["Backend"] = msg.backend;
     map["ConnectionProperties"] = msg.setupData;
     map["AdminPasswd"] = msg.adminPassword;
     map["Backend"] = msg.backend;
     map["ConnectionProperties"] = msg.setupData;
-    
+
     // Auth backend properties.
     // Auth backend properties.
-    // XXX: make these optional using core features.
-    map["AuthBackend"] = msg.authenticator;
+    map["Authenticator"] = msg.authenticator;
     map["AuthProperties"] = msg.authSetupData;
 
     QVariantMap m;
     map["AuthProperties"] = msg.authSetupData;
 
     QVariantMap m;
index c661320..eb85ebf 100644 (file)
@@ -77,7 +77,7 @@ public:
         DccFileTransfer = 0x0100,
         AwayFormatTimestamp = 0x0200,      /// Timestamp formatting in away (e.g. %%hh:mm%%)
         // Whether or not the core supports auth backends.
         DccFileTransfer = 0x0100,
         AwayFormatTimestamp = 0x0200,      /// Timestamp formatting in away (e.g. %%hh:mm%%)
         // Whether or not the core supports auth backends.
-        AuthBackends = 0x0400,
+        Authenticators = 0x0400,
 
         NumFeatures = 0x0400
     };
 
         NumFeatures = 0x0400
     };
index 018c0cd..fa52b62 100644 (file)
@@ -23,4 +23,5 @@
 Authenticator::Authenticator(QObject *parent)
     : QObject(parent)
 {
 Authenticator::Authenticator(QObject *parent)
     : QObject(parent)
 {
-}
\ No newline at end of file
+}
+
index 30f469e..ce8a42a 100644 (file)
@@ -52,7 +52,7 @@ public slots:
 
     //! Returns the display name of the authenticator backend
     /** \return A string that can be used by the client to name the authenticator backend */
 
     //! Returns the display name of the authenticator backend
     /** \return A string that can be used by the client to name the authenticator backend */
-    virtual QString displayName() const = 0;
+    virtual QString backendId() const = 0;
 
     //! Returns a description of this authenticator backend
     /** \return A string that can be displayed by the client to describe the authenticator */
 
     //! Returns a description of this authenticator backend
     /** \return A string that can be displayed by the client to describe the authenticator */
index 67f3a81..6ad6702 100644 (file)
@@ -175,7 +175,7 @@ Core::Core()
     }
 
     registerStorageBackends();
     }
 
     registerStorageBackends();
-    registerAuthenticatorBackends();
+    registerAuthenticators();
 
     connect(&_storageSyncTimer, SIGNAL(timeout()), this, SLOT(syncStorage()));
     _storageSyncTimer.start(10 * 60 * 1000); // 10 minutes
 
     connect(&_storageSyncTimer, SIGNAL(timeout()), this, SLOT(syncStorage()));
     _storageSyncTimer.start(10 * 60 * 1000); // 10 minutes
@@ -191,7 +191,7 @@ void Core::init()
 
     // Not entirely sure what is 'legacy' about the above, but it seems to be the way things work!
     QVariantMap authSettings = cs.authSettings().toMap();
 
     // Not entirely sure what is 'legacy' about the above, but it seems to be the way things work!
     QVariantMap authSettings = cs.authSettings().toMap();
-    initAuthenticator(authSettings.value("AuthBackend").toString(), authSettings.value("ConnectionProperties").toMap());
+    initAuthenticator(authSettings.value("Authenticator").toString(), authSettings.value("ConnectionProperties").toMap());
 
     if (Quassel::isOptionSet("select-backend") || Quassel::isOptionSet("select-authenticator")) {
         if (Quassel::isOptionSet("select-backend")) {
 
     if (Quassel::isOptionSet("select-backend") || Quassel::isOptionSet("select-authenticator")) {
         if (Quassel::isOptionSet("select-backend")) {
@@ -248,7 +248,7 @@ Core::~Core()
     }
     qDeleteAll(_sessions);
     qDeleteAll(_storageBackends);
     }
     qDeleteAll(_sessions);
     qDeleteAll(_storageBackends);
-    qDeleteAll(_authenticatorBackends);
+    qDeleteAll(_authenticators);
 }
 
 
 }
 
 
@@ -299,13 +299,13 @@ void Core::restoreState()
 
 /*** Core Setup ***/
 
 
 /*** Core Setup ***/
 
-QString Core::setup(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authBackend, const QVariantMap &authSetupData)
+QString Core::setup(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authenticator, const QVariantMap &authSetupData)
 {
 {
-    return instance()->setupCore(adminUser, adminPassword, backend, setupData, authBackend, authSetupData);
+    return instance()->setupCore(adminUser, adminPassword, backend, setupData, authenticator, authSetupData);
 }
 
 
 }
 
 
-QString Core::setupCore(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authBackend, const QVariantMap &authSetupData)
+QString Core::setupCore(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authenticator, const QVariantMap &authSetupData)
 {
     if (_configured)
         return tr("Core is already configured! Not configuring again...");
 {
     if (_configured)
         return tr("Core is already configured! Not configuring again...");
@@ -317,8 +317,8 @@ QString Core::setupCore(const QString &adminUser, const QString &adminPassword,
         return tr("Could not setup storage!");
     }
 
         return tr("Could not setup storage!");
     }
 
-    quInfo() << "Selected authenticator: " << authBackend;
-    if (!(_configured = initAuthenticator(authBackend, authSetupData, true)))
+    quInfo() << "Selected authenticator: " << authenticator;
+    if (!(_configured = initAuthenticator(authenticator, authSetupData, true)))
     {
         return tr("Could not setup authenticator!");
     }
     {
         return tr("Could not setup authenticator!");
     }
@@ -326,7 +326,7 @@ QString Core::setupCore(const QString &adminUser, const QString &adminPassword,
     if (!saveBackendSettings(backend, setupData)) {
         return tr("Could not save backend settings, probably a permission problem.");
     }
     if (!saveBackendSettings(backend, setupData)) {
         return tr("Could not save backend settings, probably a permission problem.");
     }
-       saveAuthBackendSettings(authBackend, authSetupData);
+    saveAuthenticatorSettings(authenticator, authSetupData);
 
     quInfo() << qPrintable(tr("Creating admin user..."));
     _storage->addUser(adminUser, adminPassword);
 
     quInfo() << qPrintable(tr("Creating admin user..."));
     _storage->addUser(adminUser, adminPassword);
@@ -390,21 +390,21 @@ void Core::unregisterStorageBackend(Storage *backend)
 // Authentication handling, now independent from storage.
 // Register and unregister authenticators.
 
 // Authentication handling, now independent from storage.
 // Register and unregister authenticators.
 
-void Core::registerAuthenticatorBackends()
+void Core::registerAuthenticators()
 {
     // Register new authentication backends here!
 {
     // Register new authentication backends here!
-    registerAuthenticatorBackend(new SqlAuthenticator(this));
+    registerAuthenticator(new SqlAuthenticator(this));
 #ifdef HAVE_LDAP
 #ifdef HAVE_LDAP
-    registerAuthenticatorBackend(new LdapAuthenticator(this));
+    registerAuthenticator(new LdapAuthenticator(this));
 #endif
 
 }
 
 #endif
 
 }
 
-bool Core::registerAuthenticatorBackend(Authenticator *authenticator)
+bool Core::registerAuthenticator(Authenticator *authenticator)
 {
     if (authenticator->isAvailable())
     {
 {
     if (authenticator->isAvailable())
     {
-        _authenticatorBackends[authenticator->displayName()] = authenticator;
+        _authenticators[authenticator->backendId()] = authenticator;
         return true;
     } else {
         authenticator->deleteLater();
         return true;
     } else {
         authenticator->deleteLater();
@@ -412,18 +412,18 @@ bool Core::registerAuthenticatorBackend(Authenticator *authenticator)
     }
 }
 
     }
 }
 
-void Core::unregisterAuthenticatorBackends()
+void Core::unregisterAuthenticators()
 {
 {
-    foreach(Authenticator* a, _authenticatorBackends.values())
+    foreach(Authenticator* a, _authenticators.values())
     {
         a->deleteLater();
     }
     {
         a->deleteLater();
     }
-    _authenticatorBackends.clear();
+    _authenticators.clear();
 }
 
 }
 
-void Core::unregisterAuthenticatorBackend(Authenticator *backend)
+void Core::unregisterAuthenticator(Authenticator *backend)
 {
 {
-    _authenticatorBackends.remove(backend->displayName());
+    _authenticators.remove(backend->backendId());
     backend->deleteLater();
 }
 
     backend->deleteLater();
 }
 
@@ -467,18 +467,19 @@ bool Core::initStorage(const QString &backend, const QVariantMap &settings, bool
     return true;
 }
 
     return true;
 }
 
-// XXX: TODO: Apparently, this is legacy?
+// FIXME: Apparently, this is the legacy way of initting storage backends?
+// If there's a not-legacy way, it should be used here
 bool Core::initAuthenticator(const QString &backend, const QVariantMap &settings, bool setup)
 {
     _authenticator = 0;
 
     if (backend.isEmpty()) {
 bool Core::initAuthenticator(const QString &backend, const QVariantMap &settings, bool setup)
 {
     _authenticator = 0;
 
     if (backend.isEmpty()) {
-            return false;
+        return false;
     }
 
     Authenticator *authenticator = 0;
     }
 
     Authenticator *authenticator = 0;
-    if (_authenticatorBackends.contains(backend)) {
-        authenticator = _authenticatorBackends[backend];
+    if (_authenticators.contains(backend)) {
+        authenticator = _authenticators[backend];
     }
     else {
         qCritical() << "Selected auth backend is not available:" << backend;
     }
     else {
         qCritical() << "Selected auth backend is not available:" << backend;
@@ -498,8 +499,8 @@ bool Core::initAuthenticator(const QString &backend, const QVariantMap &settings
         exit(EXIT_FAILURE);
     case Authenticator::IsReady:
         // delete all other backends
         exit(EXIT_FAILURE);
     case Authenticator::IsReady:
         // delete all other backends
-        _authenticatorBackends.remove(backend);
-        unregisterAuthenticatorBackends();
+        _authenticators.remove(backend);
+        unregisterAuthenticators();
     }
     _authenticator = authenticator;
     return true;
     }
     _authenticator = authenticator;
     return true;
@@ -792,9 +793,9 @@ QVariantList Core::backendInfo()
 QVariantList Core::authenticatorInfo()
 {
     QVariantList backends;
 QVariantList Core::authenticatorInfo()
 {
     QVariantList backends;
-    foreach(const Authenticator *backend, instance()->_authenticatorBackends.values()) {
+    foreach(const Authenticator *backend, instance()->_authenticators.values()) {
         QVariantMap v;
         QVariantMap v;
-        v["DisplayName"] = backend->displayName();
+        v["DisplayName"] = backend->backendId();
         v["Description"] = backend->description();
         v["SetupKeys"] = backend->setupKeys();
         v["SetupDefaults"] = backend->setupDefaults();
         v["Description"] = backend->description();
         v["SetupKeys"] = backend->setupKeys();
         v["SetupDefaults"] = backend->setupDefaults();
@@ -885,25 +886,25 @@ bool Core::selectBackend(const QString &backend)
     return true;
 }
 
     return true;
 }
 
-// XXX: I am not sure if this function is implemented correctly.
+// TODO: I am not sure if this function is implemented correctly.
 // There is currently no concept of migraiton between auth backends.
 bool Core::selectAuthenticator(const QString &backend)
 {
     // Register all authentication backends.
 // There is currently no concept of migraiton between auth backends.
 bool Core::selectAuthenticator(const QString &backend)
 {
     // Register all authentication backends.
-    registerAuthenticatorBackends();
-    if (!_authenticatorBackends.contains(backend)) {
+    registerAuthenticators();
+    if (!_authenticators.contains(backend)) {
         qWarning() << qPrintable(QString("Core::selectAuthenticator(): unsupported backend: %1").arg(backend));
         qWarning() << qPrintable(QString("Core::selectAuthenticator(): unsupported backend: %1").arg(backend));
-        qWarning() << "    supported backends are:" << qPrintable(QStringList(_authenticatorBackends.keys()).join(", "));
+        qWarning() << "    supported backends are:" << qPrintable(QStringList(_authenticators.keys()).join(", "));
         return false;
     }
 
         return false;
     }
 
-    Authenticator *authenticator = _authenticatorBackends[backend];
+    Authenticator *authenticator = _authenticators[backend];
     QVariantMap settings = promptForSettings(authenticator);
 
     Authenticator::State state = authenticator->init(settings);
     switch (state) {
     case Authenticator::IsReady:
     QVariantMap settings = promptForSettings(authenticator);
 
     Authenticator::State state = authenticator->init(settings);
     switch (state) {
     case Authenticator::IsReady:
-        saveAuthBackendSettings(backend, settings);
+        saveAuthenticatorSettings(backend, settings);
         qWarning() << "Switched auth backend to:" << qPrintable(backend);
 //        qWarning() << "Auth backend already initialized. Skipping Migration";
         return true;
         qWarning() << "Switched auth backend to:" << qPrintable(backend);
 //        qWarning() << "Auth backend already initialized. Skipping Migration";
         return true;
@@ -921,7 +922,7 @@ bool Core::selectAuthenticator(const QString &backend)
             return false;
         }
 
             return false;
         }
 
-        saveAuthBackendSettings(backend, settings);
+        saveAuthenticatorSettings(backend, settings);
         qWarning() << "Switched auth backend to:" << qPrintable(backend);
     }
     
         qWarning() << "Switched auth backend to:" << qPrintable(backend);
     }
     
@@ -1030,7 +1031,7 @@ bool Core::changeUserPassword(UserId userId, const QString &password)
     return instance()->_storage->updateUser(userId, password);
 }
 
     return instance()->_storage->updateUser(userId, password);
 }
 
-// XXX: this code isn't currently 100% optimal because the core
+// TODO: this code isn't currently 100% optimal because the core
 // doesn't know it can have multiple auth providers configured (there aren't
 // multiple auth providers at the moment anyway) and we have hardcoded the
 // Database provider to be always allowed.
 // doesn't know it can have multiple auth providers configured (there aren't
 // multiple auth providers at the moment anyway) and we have hardcoded the
 // Database provider to be always allowed.
@@ -1039,7 +1040,7 @@ bool Core::canChangeUserPassword(UserId userId)
     QString authProvider = instance()->_storage->getUserAuthenticator(userId);
     if (authProvider != "Database")
     {
     QString authProvider = instance()->_storage->getUserAuthenticator(userId);
     if (authProvider != "Database")
     {
-        if (authProvider != instance()->_authenticator->displayName()) {
+        if (authProvider != instance()->_authenticator->backendId()) {
             return false;
         } else if (instance()->_authenticator->canChangePassword()) {
             return false;
             return false;
         } else if (instance()->_authenticator->canChangePassword()) {
             return false;
@@ -1088,10 +1089,10 @@ bool Core::saveBackendSettings(const QString &backend, const QVariantMap &settin
     return s.sync();
 }
 
     return s.sync();
 }
 
-void Core::saveAuthBackendSettings(const QString &backend, const QVariantMap &settings)
+void Core::saveAuthenticatorSettings(const QString &backend, const QVariantMap &settings)
 {
     QVariantMap dbsettings;
 {
     QVariantMap dbsettings;
-    dbsettings["AuthBackend"] = backend;
+    dbsettings["Authenticator"] = backend;
     dbsettings["ConnectionProperties"] = settings;
     CoreSettings().setAuthSettings(dbsettings);
 }
     dbsettings["ConnectionProperties"] = settings;
     CoreSettings().setAuthSettings(dbsettings);
 }
index 3eb4313..66fc50b 100644 (file)
@@ -556,7 +556,7 @@ public:
         return (backend->displayName() == "SQLite") ? true : false;
     }
 
         return (backend->displayName() == "SQLite") ? true : false;
     }
 
-    static QString setup(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authBackend, const QVariantMap &authSetupMap);
+    static QString setup(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authenticator, const QVariantMap &authSetupMap);
 
     static inline QTimer &syncTimer() { return instance()->_storageSyncTimer; }
 
 
     static inline QTimer &syncTimer() { return instance()->_storageSyncTimer; }
 
@@ -570,7 +570,7 @@ public slots:
      */
     void syncStorage();
     void setupInternalClientSession(InternalPeer *clientConnection);
      */
     void syncStorage();
     void setupInternalClientSession(InternalPeer *clientConnection);
-    QString setupCore(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authBackend, const QVariantMap &authSetupMap);
+    QString setupCore(const QString &adminUser, const QString &adminPassword, const QString &backend, const QVariantMap &setupData, const QString &authenticator, const QVariantMap &authSetupMap);
 
 signals:
     //! Sent when a BufferInfo is updated in storage.
 
 signals:
     //! Sent when a BufferInfo is updated in storage.
@@ -612,16 +612,17 @@ private:
     void unregisterStorageBackends();
     void unregisterStorageBackend(Storage *);
 
     void unregisterStorageBackends();
     void unregisterStorageBackend(Storage *);
 
-    void registerAuthenticatorBackends();
-    bool registerAuthenticatorBackend(Authenticator *);
-    void unregisterAuthenticatorBackends();
-    void unregisterAuthenticatorBackend(Authenticator *);
+    void registerAuthenticators();
+    bool registerAuthenticator(Authenticator *);
+    void unregisterAuthenticators();
+    void unregisterAuthenticator(Authenticator *);
 
     bool selectBackend(const QString &backend);
     bool selectAuthenticator(const QString &backend);
     bool createUser();
 
     bool selectBackend(const QString &backend);
     bool selectAuthenticator(const QString &backend);
     bool createUser();
+
     bool saveBackendSettings(const QString &backend, const QVariantMap &settings);
     bool saveBackendSettings(const QString &backend, const QVariantMap &settings);
-    void saveAuthBackendSettings(const QString &backend, const QVariantMap &settings);
+    void saveAuthenticatorSettings(const QString &backend, const QVariantMap &settings);
 
     QVariantMap promptForSettings(const Storage *storage);
     QVariantMap promptForSettings(const Authenticator *authenticator);
 
     QVariantMap promptForSettings(const Storage *storage);
     QVariantMap promptForSettings(const Authenticator *authenticator);
@@ -645,7 +646,7 @@ private:
     OidentdConfigGenerator *_oidentdConfigGenerator;
 
     QHash<QString, Storage *> _storageBackends;
     OidentdConfigGenerator *_oidentdConfigGenerator;
 
     QHash<QString, Storage *> _storageBackends;
-    QHash<QString, Authenticator *> _authenticatorBackends;
+    QHash<QString, Authenticator *> _authenticators;
 
     QDateTime _startTime;
 
 
     QDateTime _startTime;
 
index a4c06f3..c7251cf 100644 (file)
@@ -196,16 +196,16 @@ void CoreAuthHandler::handle(const SetupData &msg)
     if (!checkClientRegistered())
         return;
 
     if (!checkClientRegistered())
         return;
 
-    // The default parameter to authBackend is Database.
+    // The default parameter to authenticator is Database.
     // Maybe this should be hardcoded elsewhere, i.e. as a define.
     // Maybe this should be hardcoded elsewhere, i.e. as a define.
-    QString authBackend = msg.authenticator;
-    quInfo() << "[" << authBackend << "]";
-    if (authBackend.trimmed().isEmpty() || authBackend == 0)
+    QString authenticator = msg.authenticator;
+    quInfo() << "[" << authenticator << "]";
+    if (authenticator.trimmed().isEmpty() || authenticator == 0)
     {
     {
-        authBackend = QString("Database");
+        authenticator = QString("Database");
     }
 
     }
 
-    QString result = Core::setup(msg.adminUser, msg.adminPassword, msg.backend, msg.setupData, authBackend, msg.authSetupData);
+    QString result = Core::setup(msg.adminUser, msg.adminPassword, msg.backend, msg.setupData, authenticator, msg.authSetupData);
     if (!result.isEmpty())
         _peer->dispatch(SetupFailed(result));
     else
     if (!result.isEmpty())
         _peer->dispatch(SetupFailed(result));
     else
index 5b62b89..240e0ea 100644 (file)
@@ -59,11 +59,11 @@ LdapAuthenticator::~LdapAuthenticator()
 
 bool LdapAuthenticator::isAvailable() const
 {
 
 bool LdapAuthenticator::isAvailable() const
 {
-    // XXX: probably this should test if we can speak to the LDAP server.
+    // FIXME: probably this should test if we can speak to the LDAP server.
     return true;
 }
 
     return true;
 }
 
-QString LdapAuthenticator::displayName() const
+QString LdapAuthenticator::backendId() const
 {
     // We identify the backend to use for the monolithic core by its displayname.
     // so only change this string if you _really_ have to and make sure the core
 {
     // We identify the backend to use for the monolithic core by its displayname.
     // so only change this string if you _really_ have to and make sure the core
@@ -110,7 +110,7 @@ void LdapAuthenticator::setConnectionProperties(const QVariantMap &properties)
     _uidAttribute = properties["UID Attribute"].toString();
 }
 
     _uidAttribute = properties["UID Attribute"].toString();
 }
 
-// XXX: this code is sufficiently general that in the future, perhaps an abstract
+// TODO: this code is sufficiently general that in the future, perhaps an abstract
 // class should be created implementing it.
 // i.e. a provider that does its own thing and then pokes at the current storage
 // through the default core method.
 // class should be created implementing it.
 // i.e. a provider that does its own thing and then pokes at the current storage
 // through the default core method.
@@ -130,9 +130,9 @@ UserId LdapAuthenticator::validateUser(const QString &username, const QString &p
     UserId quasselID = Core::validateUser(username, QString());
     if (!quasselID.isValid())
     {
     UserId quasselID = Core::validateUser(username, QString());
     if (!quasselID.isValid())
     {
-        return Core::addUser(username, QString(), displayName());
+        return Core::addUser(username, QString(), backendId());
     }
     }
-    else if (!(Core::checkAuthProvider(quasselID, displayName())))
+    else if (!(Core::checkAuthProvider(quasselID, backendId())))
     {
         return 0;
     }
     {
         return 0;
     }
@@ -153,11 +153,11 @@ Authenticator::State LdapAuthenticator::init(const QVariantMap &settings)
     bool status = ldapConnect();
     if (!status)
     {
     bool status = ldapConnect();
     if (!status)
     {
-        quInfo() << qPrintable(displayName()) << "Authenticator cannot connect.";
+        quInfo() << qPrintable(backendId()) << "Authenticator cannot connect.";
         return NotAvailable;
     }
 
         return NotAvailable;
     }
 
-    quInfo() << qPrintable(displayName()) << "Authenticator is ready.";
+    quInfo() << qPrintable(backendId()) << "Authenticator is ready.";
     return IsReady;
 }
 
     return IsReady;
 }
 
index 2281c68..ff05c4f 100644 (file)
@@ -57,7 +57,7 @@ public:
 public slots:
     /* General */
     bool isAvailable() const;
 public slots:
     /* General */
     bool isAvailable() const;
-    QString displayName() const;
+    QString backendId() const;
     QString description() const;
     virtual QStringList setupKeys() const;
     virtual QVariantMap setupDefaults() const;
     QString description() const;
     virtual QStringList setupKeys() const;
     virtual QVariantMap setupDefaults() const;
index 52f0ac6..f1ed169 100644 (file)
@@ -38,11 +38,11 @@ SqlAuthenticator::~SqlAuthenticator()
 
 bool SqlAuthenticator::isAvailable() const
 {
 
 bool SqlAuthenticator::isAvailable() const
 {
-    // XXX: probably this should query the current storage (see the ::init routine too).
+    // FIXME: probably this should query the current storage (see the ::init routine too).
     return true;
 }
 
     return true;
 }
 
-QString SqlAuthenticator::displayName() const
+QString SqlAuthenticator::backendId() const
 {
     // We identify the backend to use for the monolithic core by its displayname.
     // so only change this string if you _really_ have to and make sure the core
 {
     // We identify the backend to use for the monolithic core by its displayname.
     // so only change this string if you _really_ have to and make sure the core
@@ -71,6 +71,6 @@ Authenticator::State SqlAuthenticator::init(const QVariantMap &settings)
     // TODO: FIXME: this should check if the storage provider is ready, but I don't
     // know if there's an exposed way to do that at the moment.
 
     // TODO: FIXME: this should check if the storage provider is ready, but I don't
     // know if there's an exposed way to do that at the moment.
 
-    quInfo() << qPrintable(displayName()) << "Authenticator is ready.";
+    quInfo() << qPrintable(backendId()) << "Authenticator is ready.";
     return IsReady;
 }
     return IsReady;
 }
index 378a9d4..4f2c71f 100644 (file)
@@ -34,7 +34,7 @@ public:
 public slots:
     /* General */
     bool isAvailable() const;
 public slots:
     /* General */
     bool isAvailable() const;
-    QString displayName() const;
+    QString backendId() const;
     QString description() const;
     virtual inline QStringList setupKeys() const { return QStringList(); }
     virtual inline QVariantMap setupDefaults() const { return QVariantMap(); }
     QString description() const;
     virtual inline QStringList setupKeys() const { return QStringList(); }
     virtual inline QVariantMap setupDefaults() const { return QVariantMap(); }
index 5119f17..ee9dd0d 100644 (file)
@@ -94,7 +94,7 @@ QHash<QString, QVariant> CoreConfigWizard::authenticators() const
     return _authenticators;
 }
 
     return _authenticators;
 }
 
-void CoreConfigWizard::prepareCoreSetup(const QString &backend, const QVariantMap &properties, const QString &authBackend, const QVariantMap &authProperties)
+void CoreConfigWizard::prepareCoreSetup(const QString &backend, const QVariantMap &properties, const QString &authenticator, const QVariantMap &authProperties)
 {
     // Prevent the user from changing any settings he already specified...
     foreach(int idx, visitedPages())
 {
     // Prevent the user from changing any settings he already specified...
     foreach(int idx, visitedPages())
@@ -102,11 +102,11 @@ void CoreConfigWizard::prepareCoreSetup(const QString &backend, const QVariantMa
 
     // FIXME? We need to be able to set up older cores that don't have auth backend support.
     // So if the core doesn't support that feature, don't pass those parameters.
 
     // FIXME? We need to be able to set up older cores that don't have auth backend support.
     // So if the core doesn't support that feature, don't pass those parameters.
-    if (!(Client::coreFeatures() & Quassel::AuthBackends))
+    if (!(Client::coreFeatures() & Quassel::Authenticators))
     {
         coreConnection()->setupCore(Protocol::SetupData(field("adminUser.user").toString(), field("adminUser.password").toString(), backend, properties));
     } else {
     {
         coreConnection()->setupCore(Protocol::SetupData(field("adminUser.user").toString(), field("adminUser.password").toString(), backend, properties));
     } else {
-        coreConnection()->setupCore(Protocol::SetupData(field("adminUser.user").toString(), field("adminUser.password").toString(), backend, properties, authBackend, authProperties));
+        coreConnection()->setupCore(Protocol::SetupData(field("adminUser.user").toString(), field("adminUser.password").toString(), backend, properties, authenticator, authProperties));
     }
 }
 
     }
 }
 
@@ -194,7 +194,7 @@ AdminUserPage::AdminUserPage(QWidget *parent) : QWizardPage(parent)
 int AdminUserPage::nextId() const
 {
     // If the core doesn't support auth backends, skip that page!
 int AdminUserPage::nextId() const
 {
     // If the core doesn't support auth backends, skip that page!
-    if (!(Client::coreFeatures() & Quassel::AuthBackends))
+    if (!(Client::coreFeatures() & Quassel::Authenticators))
     {
         return CoreConfigWizard::StorageSelectionPage;
     } else {
     {
         return CoreConfigWizard::StorageSelectionPage;
     } else {
@@ -534,14 +534,14 @@ void SyncPage::initializePage()
 
     // Fill in sync info about the authentication layer.
     AuthenticationSelectionPage *authPage = qobject_cast<AuthenticationSelectionPage *>(wizard()->page(CoreConfigWizard::AuthenticationSelectionPage));
 
     // Fill in sync info about the authentication layer.
     AuthenticationSelectionPage *authPage = qobject_cast<AuthenticationSelectionPage *>(wizard()->page(CoreConfigWizard::AuthenticationSelectionPage));
-    QString authBackend = authPage->selectedBackend();
+    QString authenticator = authPage->selectedBackend();
     QVariantMap authProperties = authPage->connectionProperties();
     QVariantMap authProperties = authPage->connectionProperties();
-    Q_ASSERT(!authBackend.isEmpty());
-    ui.authBackend->setText(authBackend);
+    Q_ASSERT(!authenticator.isEmpty());
+    ui.authenticator->setText(authenticator);
 
     ui.user->setText(wizard()->field("adminUser.user").toString());
 
 
     ui.user->setText(wizard()->field("adminUser.user").toString());
 
-    emit setupCore(backend, properties, authBackend, authProperties);
+    emit setupCore(backend, properties, authenticator, authProperties);
 }
 
 
 }
 
 
index 5b7cb8a..b22fd19 100644 (file)
@@ -69,7 +69,7 @@ public slots:
     void syncFinished();
 
 private slots:
     void syncFinished();
 
 private slots:
-    void prepareCoreSetup(const QString &backend, const QVariantMap &properties, const QString &authBackend, const QVariantMap &authProperties);
+    void prepareCoreSetup(const QString &backend, const QVariantMap &properties, const QString &authenticator, const QVariantMap &authProperties);
     void coreSetupSuccess();
     void coreSetupFailed(const QString &);
     void startOver();
     void coreSetupSuccess();
     void coreSetupFailed(const QString &);
     void startOver();
index f6aa446..4495bfe 100644 (file)
@@ -1366,9 +1366,9 @@ void MainWin::showCoreConnectionDlg()
 }
 
 
 }
 
 
-void MainWin::showCoreConfigWizard(const QVariantList &backends, const QVariantList &authBackends)
+void MainWin::showCoreConfigWizard(const QVariantList &backends, const QVariantList &authenticators)
 {
 {
-    CoreConfigWizard *wizard = new CoreConfigWizard(Client::coreConnection(), backends, authBackends, this);
+    CoreConfigWizard *wizard = new CoreConfigWizard(Client::coreConnection(), backends, authenticators, this);
 
     wizard->show();
 }
 
     wizard->show();
 }
index 1911be9..6345ef7 100644 (file)
@@ -77,7 +77,7 @@
            </widget>
           </item>
           <item row="2" column="1" >
            </widget>
           </item>
           <item row="2" column="1" >
-           <widget class="QLabel" name="authBackend" >
+           <widget class="QLabel" name="authenticator" >
             <property name="text" >
              <string>bar</string>
             </property>
             <property name="text" >
              <string>bar</string>
             </property>