X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fldapauthenticator.h;h=4e586129054a2165f649a3e680faea4bd4ceffde;hb=71d3d0d705a853fa8fea3729e13dbddf52363417;hp=cf146940cdab24461ea925a9c3cc5e0dfee87c05;hpb=d6f3eedebc7f9619b04dffc5f48faa792950fdcd;p=quassel.git diff --git a/src/core/ldapauthenticator.h b/src/core/ldapauthenticator.h index cf146940..4e586129 100644 --- a/src/core/ldapauthenticator.h +++ b/src/core/ldapauthenticator.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2016 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -26,18 +26,24 @@ * */ -#ifndef LDAPAUTHENTICATOR_H -#define LDAPAUTHENTICATOR_H +#pragma once #include "authenticator.h" #include "core.h" // Link against LDAP. +/* We should use openldap on windows if at all possible, rather than trying to + * write some kind of compatiblity routine. +#ifdef Q_CC_MSVC +#include +#include +#else*/ #include +//#endif // Default LDAP server port. -#define DEFAULT_LDAP_PORT 389 +constexpr int DEFAULT_LDAP_PORT = 389; class LdapAuthenticator : public Authenticator { @@ -45,31 +51,33 @@ class LdapAuthenticator : public Authenticator public: LdapAuthenticator(QObject *parent = 0); - virtual ~LdapAuthenticator(); + ~LdapAuthenticator() override; public slots: /* General */ - bool isAvailable() const; - QString displayName() const; - QString description() const; - virtual QStringList setupKeys() const; - virtual QVariantMap setupDefaults() const; + bool isAvailable() const override; + QString backendId() const override; + QString displayName() const override; + QString description() const override; + QVariantList setupData() const override; - bool setup(const QVariantMap &settings = QVariantMap()); - State init(const QVariantMap &settings = QVariantMap()); - UserId validateUser(const QString &user, const QString &password); + bool canChangePassword() const override { return false; } + + bool setup(const QVariantMap &settings = {}) override; + State init(const QVariantMap &settings = {}) override; + UserId validateUser(const QString &user, const QString &password) override; protected: - virtual void setConnectionProperties(const QVariantMap &properties); + void setAuthProperties(const QVariantMap &properties); bool ldapConnect(); void ldapDisconnect(); bool ldapAuth(const QString &username, const QString &password); // Protected methods for retrieving info about the LDAP connection. - inline virtual QString hostName() { return _hostName; } - inline virtual int port() { return _port; } - inline virtual QString bindDN() { return _bindDN; } - inline virtual QString baseDN() { return _baseDN; } + QString hostName() const { return _hostName; } + int port() const { return _port; } + QString bindDN() const { return _bindDN; } + QString baseDN() const { return _baseDN; } private: QString _hostName; @@ -81,9 +89,5 @@ private: QString _uidAttribute; // The actual connection object. - LDAP *_connection; - + LDAP *_connection {nullptr}; }; - - -#endif