diff options
Diffstat (limited to 'src/Common')
-rw-r--r-- | src/Common/AuthManager.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Common/AuthManager.cpp b/src/Common/AuthManager.cpp index c4cace7..38ac9e3 100644 --- a/src/Common/AuthManager.cpp +++ b/src/Common/AuthManager.cpp @@ -77,16 +77,20 @@ std::vector<std::string> AuthManager::getSubMethods(const std::string &method) t boost::shared_ptr<AuthContext> AuthManager::authenticate(const std::string &method, const std::string &subMethod, const std::string &user, const std::vector<boost::uint8_t> &data, std::vector<boost::uint8_t> &response, boost::shared_ptr<AuthContext> context) throw(Core::Exception) { - boost::lock_guard<boost::shared_mutex> lock(mutex); + std::map<std::string, boost::shared_ptr<AuthBackend> >::iterator backend; - response.clear(); + { + boost::lock_guard<boost::shared_mutex> lock(mutex); - std::map<std::string, boost::shared_ptr<AuthBackend> >::iterator backend = backends.find(method); - if(backend == backends.end()) - throw Core::Exception(Core::Exception::NOT_IMPLEMENTED); + response.clear(); - if(!provider) - throw Core::Exception(Core::Exception::NOT_AVAILABLE); + backend = backends.find(method); + if(backend == backends.end()) + throw Core::Exception(Core::Exception::NOT_IMPLEMENTED); + + if(!provider) + throw Core::Exception(Core::Exception::NOT_AVAILABLE); + } return backend->second->authenticate(provider, subMethod, user, data, response, context); } |