userver: userver/server/handlers/auth/digest/context.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
context.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/server/handlers/auth/digest/context.hpp
4/// @brief Context structures for Digest Authentication
5
6#include <string>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace server::handlers::auth::digest {
11
12/// WWW-Authenticate header from server response
13/// realm, nonce directives are mandatory
14/// domain, opaque, stale, algorithm, qop, auth-param directives are optional
16 std::string realm;
17 std::string nonce;
18 std::string algorithm;
19 bool stale{false};
20 std::string authparam;
21 std::string qop;
22 std::string opaque;
23};
24
25/// Authorization header from client request
26/// username, realm, nonce, digest-uri directives response are mandatory
27/// algorithm, cnonce, opaque, qop, nc, auth-param directives are optional
29 std::string username;
30 std::string realm;
31 std::string nonce;
32 std::string uri;
33 std::string response;
34 std::string algorithm;
35 std::string cnonce;
36 std::string opaque;
37 std::string qop;
38 std::string nc;
39 std::string authparam;
40};
41
42/// Max number of directives in Authorization header.
43/// Must be equal to the number of DigestContextFromClient fields.
44inline constexpr std::size_t kMaxClientDirectivesNumber = 11;
45
46/// Number of mandatory directives in Authorization header.
47inline constexpr std::size_t kClientMandatoryDirectivesNumber = 5;
48
49} // namespace server::handlers::auth::digest
50USERVER_NAMESPACE_END