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/loggable_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 {
40 public:
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,
47 const components::ComponentContext& context);
48
49 ~NonceCacheSettingsComponent() final;
50
51 const NonceCacheSettings& GetSettings() const;
52
53 static yaml_config::Schema GetStaticConfigSchema();
54
55 private:
56 NonceCacheSettings settings_;
57};
58
59} // namespace server::handlers::auth::digest
60
61template <>
62inline constexpr bool components::kHasValidate<
63 server::handlers::auth::digest::NonceCacheSettingsComponent> = true;
64
65USERVER_NAMESPACE_END