/* * Copyright (C) 2018-present ScyllaDB */ /* * SPDX-License-Identifier: AGPL-3.0-or-later */ #pragma once #include #include #include #include #include #include #include "seastarx.hh" namespace auth { enum class authentication_option { password, options }; } template <> struct fmt::formatter : fmt::formatter { template auto format(const auth::authentication_option a, FormatContext& ctx) const { using enum auth::authentication_option; switch (a) { case password: return formatter::format("PASSWORD", ctx); case options: return formatter::format("OPTIONS", ctx); } std::abort(); } }; namespace auth { using authentication_option_set = std::unordered_set; using custom_options = std::unordered_map; struct authentication_options final { std::optional password; std::optional options; }; inline bool any_authentication_options(const authentication_options& aos) noexcept { return aos.password || aos.options; } class unsupported_authentication_option : public std::invalid_argument { public: explicit unsupported_authentication_option(authentication_option k) : std::invalid_argument(format("The {} option is not supported.", k)) { } }; }