10#include <userver/components/component_context.hpp>
11#include <userver/server/handlers/auth/auth_checker_base.hpp>
12#include <userver/server/handlers/handler_config.hpp>
13#include <userver/utils/not_null.hpp>
15USERVER_NAMESPACE_BEGIN
17namespace server::handlers::auth {
22 virtual ~AuthCheckerFactoryBase() =
default;
24 virtual AuthCheckerBasePtr MakeAuthChecker(
const HandlerAuthConfig&)
const = 0;
29using AuthCheckerFactoryFactory = utils::UniqueRef<
AuthCheckerFactoryBase> (*)(
const components::ComponentContext&);
31void DoRegisterAuthCheckerFactory(std::string_view auth_type, AuthCheckerFactoryFactory factory);
34 std::string_view auth_type,
35 const components::ComponentContext& context
38std::vector<std::string> GetAllAuthTypes();
40template <
typename AuthCheckerFactory>
41utils::UniqueRef<
AuthCheckerFactoryBase> MakeAuthCheckerFactory(
const components::ComponentContext& context) {
42 return utils::MakeUniqueRef<AuthCheckerFactory>(context);
53template <
typename AuthCheckerFactory>
55 const auto auth_type = std::string_view{AuthCheckerFactory::kAuthType};
56 impl::DoRegisterAuthCheckerFactory(auth_type, &impl::MakeAuthCheckerFactory<AuthCheckerFactory>);