summaryrefslogtreecommitdiffstats
path: root/src/modules/AuthProviderFile
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/AuthProviderFile')
-rw-r--r--src/modules/AuthProviderFile/AuthProviderFile.cpp34
-rw-r--r--src/modules/AuthProviderFile/AuthProviderFile.h3
2 files changed, 7 insertions, 30 deletions
diff --git a/src/modules/AuthProviderFile/AuthProviderFile.cpp b/src/modules/AuthProviderFile/AuthProviderFile.cpp
index 177d633..4522092 100644
--- a/src/modules/AuthProviderFile/AuthProviderFile.cpp
+++ b/src/modules/AuthProviderFile/AuthProviderFile.cpp
@@ -88,33 +88,9 @@ void AuthProviderFile::readFile(const std::string &name) {
}
}
-bool AuthProviderFile::handleConfigEntry(const Core::ConfigEntry &entry, bool /*handled*/) {
- if(!entry[0].getKey().matches("AuthProviderFile"))
- return false;
+void AuthProviderFile::configure() {
+ filehash = application->getConfigManager()->get("AuthProviderFile.Hash");
- if(entry[1].isEmpty())
- return true;
-
- if(entry[1].getKey().matches("Hash")) {
- if(entry[2].isEmpty()) {
- filehash = entry[1][0];
-
- if(!Common::Hash::isHashSupported(filehash))
- application->logf(Core::Logger::LOG_WARNING, "AuthProviderFile: Unsupported hash '%s'", filehash.toLocale().c_str());
- }
- }
- else if(entry[1].getKey().matches("File")) {
- if(entry[2].isEmpty()) {
- files.push_back(entry[1][0]);
- }
- }
- else if(!entry[2].isEmpty())
- return false;
-
- return true;
-}
-
-void AuthProviderFile::configFinished() {
if(filehash.isEmpty() || filehash.matches("clear")) {
hashes = Common::Hash::getHashList();
filehash.remove();
@@ -126,8 +102,10 @@ void AuthProviderFile::configFinished() {
hashes.push_back("Clear");
- for(std::vector<Core::String>::iterator file = files.begin(); file != files.end(); ++file)
- readFile(file->toLocale());
+ std::vector<const Core::ConfigEntry*> fileEntries = application->getConfigManager()->getEntries("AuthProviderFile.File");
+ for(std::vector<const Core::ConfigEntry*>::iterator fileEntry = fileEntries.begin(); fileEntry != fileEntries.end(); ++fileEntry) {
+ readFile((*fileEntry)->getValue().toLocale());
+ }
}
bool AuthProviderFile::checkPassword(const Core::String &user, const std::vector<boost::uint8_t> &data, const Core::String &hash) throw(Core::Exception) {
diff --git a/src/modules/AuthProviderFile/AuthProviderFile.h b/src/modules/AuthProviderFile/AuthProviderFile.h
index 6ca907f..25a30b5 100644
--- a/src/modules/AuthProviderFile/AuthProviderFile.h
+++ b/src/modules/AuthProviderFile/AuthProviderFile.h
@@ -50,8 +50,7 @@ class MAD_MODULE_EXPORT AuthProviderFile : public Common::AuthProvider, private
std::vector<Core::String> hashes;
protected:
- virtual bool handleConfigEntry(const Core::ConfigEntry &entry, bool /*handled*/);
- virtual void configFinished();
+ virtual void configure();
virtual const std::vector<Core::String>& getHashes() const {
return hashes;