userver: userver/server/handlers/auth/digest/nonce_cache_settings_component.hpp Source File
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
nonce_cache_settings_component.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/server/handlers/auth/digest/nonce_cache_settings_component.hpp
4/// @brief @copybrief server::handlers::auth::digest::NonceCacheSettingsComponent
5
6#include <chrono>
7#include <cstddef>
8#include <optional>
9#include <string>
10
11#include <userver/components/component_base.hpp>
12#include <userver/dynamic_config/source.hpp>
13#include <userver/server/handlers/auth/digest/auth_checker_settings_component.hpp>
14
16
17USERVER_NAMESPACE_BEGIN
18
19namespace server::handlers::auth::digest {
20
22 std::size_t ways{};
23 std::size_t way_size{};
24};
25
26// clang-format off
27
28/// @brief Component that loads nonce cache settings from a static_config.yaml
29/// ## Static options:
30///
31/// Name | Description | Default value
32/// ------ | --------------------------------------| -------------
33/// size | max amount of items to store in cache | -
34/// ways | number of ways for associative cache | -
35
36// clang-format on
37
38class NonceCacheSettingsComponent final : public AuthCheckerSettingsComponent {
39public:
40 /// @ingroup userver_component_names
41 /// @brief The default name of
42 /// server::handlers::auth::NonceCacheSettingsComponent
43 static constexpr std::string_view kName = "nonce-cache-settings";
44
45 NonceCacheSettingsComponent(const components::ComponentConfig& config, const components::ComponentContext& context);
46
47 ~NonceCacheSettingsComponent() final;
48
49 const NonceCacheSettings& GetSettings() const;
50
51 static yaml_config::Schema GetStaticConfigSchema();
52
53private:
54 NonceCacheSettings settings_;
55};
56
57} // namespace server::handlers::auth::digest
58
59template <>
60inline constexpr bool components::kHasValidate<server::handlers::auth::digest::NonceCacheSettingsComponent> = true;
61
62USERVER_NAMESPACE_END