/* * AuthManager.h * * Copyright (C) 2009 Matthias Schiffer * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with this program. If not, see . */ #ifndef MAD_COMMON_AUTHMANAGER_H_ #define MAD_COMMON_AUTHMANAGER_H_ #include "export.h" #include "AuthContext.h" #include #include #include #include #include #include namespace Mad { namespace Common { class Application; class AuthBackend; class AuthProvider; class MAD_COMMON_EXPORT AuthManager : private boost::noncopyable { private: friend class Application; boost::shared_ptr provider; std::set methods; std::map > backends; boost::shared_mutex mutex; AuthManager() {} public: void setProvider(boost::shared_ptr newProvider); void unsetProvider(boost::shared_ptr oldProvider); void registerBackend(boost::shared_ptr backend); void unregisterBackend(boost::shared_ptr backend); const std::set& getMethods(); std::vector getSubMethods(const Core::String &method) throw(Core::Exception); boost::shared_ptr authenticate(const Core::String &method, const Core::String &subMethod, const Core::String &user, const std::vector &data, std::vector &response, boost::shared_ptr context = boost::shared_ptr()) throw(Core::Exception); }; } } #endif /* MAD_COMMON_AUTHMANAGER_H_ */