userver: userver/server/handlers/auth/digest/types.hpp Source File
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/server/handlers/auth/digest/types.hpp
4/// @brief Types for validating directive values
5
6#include <userver/utils/trivial_map.hpp>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace server::handlers::auth::digest {
11
12/// @brief Supported hashing algorithms
13enum class HashAlgTypes {
14 kMD5, ///< MD5 algorithm
15 kSHA256, ///< SHA256 algorithm
16 kSHA512, ///< SHA512 algorithm
17 kUnknown ///< Unknown algorithm
18};
19
20/// @brief Supported `qop-options` from
21/// https://datatracker.ietf.org/doc/html/rfc2617#section-3.2.1
22enum class QopTypes {
23 kAuth, ///< `The value "auth" indicates authentication` from
24 ///< https://datatracker.ietf.org/doc/html/rfc2617#section-3.2.1
25 kUnknown ///< Unknown qop-value
26};
27
28inline constexpr utils::TrivialBiMap kHashAlgToType = [](auto selector) {
29 return selector()
30 .Case("md5", HashAlgTypes::kMD5)
31 .Case("sha256", HashAlgTypes::kSHA256)
32 .Case("sha512", HashAlgTypes::kSHA512);
33};
34
35inline constexpr utils::TrivialBiMap kQopToType = [](auto selector) {
36 return selector().Case("auth", QopTypes::kAuth);
37};
38
39// enum
40
41} // namespace server::handlers::auth::digest
42
43USERVER_NAMESPACE_END