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