* 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:
-# 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)
set(Ldap_FIND_QUIETLY TRUE)
endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
set(Ldap_FIND_QUIETLY TRUE)
endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
# 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)
+# 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)
if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
set(LDAP_FOUND TRUE)
if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES)
set(LDAP_FOUND TRUE)
{
_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));
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();
#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);
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;
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);
#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");
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;
}
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") {
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);
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;
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") {
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;
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;
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.
+ Authenticators = 0x0400,
Authenticator::Authenticator(QObject *parent)
: QObject(parent)
{
Authenticator::Authenticator(QObject *parent)
: QObject(parent)
{
-}
\ No newline at end of file
//! 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 */
}
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
// 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")) {
}
qDeleteAll(_sessions);
qDeleteAll(_storageBackends);
}
qDeleteAll(_sessions);
qDeleteAll(_storageBackends);
- qDeleteAll(_authenticatorBackends);
+ qDeleteAll(_authenticators);
-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...");
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!");
}
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);
// 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));
- registerAuthenticatorBackend(new LdapAuthenticator(this));
+ registerAuthenticator(new LdapAuthenticator(this));
-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();
-void Core::unregisterAuthenticatorBackends()
+void Core::unregisterAuthenticators()
- foreach(Authenticator* a, _authenticatorBackends.values())
+ foreach(Authenticator* a, _authenticators.values())
- _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();
}
-// 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()) {
}
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;
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;
QVariantList Core::authenticatorInfo()
{
QVariantList backends;
QVariantList Core::authenticatorInfo()
{
QVariantList backends;
- foreach(const Authenticator *backend, instance()->_authenticatorBackends.values()) {
+ foreach(const Authenticator *backend, instance()->_authenticators.values()) {
- 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();
-// 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(", "));
- 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;
- saveAuthBackendSettings(backend, settings);
+ saveAuthenticatorSettings(backend, settings);
qWarning() << "Switched auth backend to:" << qPrintable(backend);
}
qWarning() << "Switched auth backend to:" << qPrintable(backend);
}
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.
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;
-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);
}
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; }
*/
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.
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);
OidentdConfigGenerator *_oidentdConfigGenerator;
QHash<QString, Storage *> _storageBackends;
OidentdConfigGenerator *_oidentdConfigGenerator;
QHash<QString, Storage *> _storageBackends;
- QHash<QString, Authenticator *> _authenticatorBackends;
+ QHash<QString, Authenticator *> _authenticators;
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
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.
-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
_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.
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())))
bool status = ldapConnect();
if (!status)
{
bool status = ldapConnect();
if (!status)
{
- quInfo() << qPrintable(displayName()) << "Authenticator cannot connect.";
+ quInfo() << qPrintable(backendId()) << "Authenticator cannot connect.";
- quInfo() << qPrintable(displayName()) << "Authenticator is ready.";
+ quInfo() << qPrintable(backendId()) << "Authenticator is ready.";
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;
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).
-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
// 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.";
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(); }
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())
// 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));
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 {
// 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);
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();
-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);
</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>