Thoth
A functional, expressive, asynchronous C++26 webdev library
Loading...
Searching...
No Matches
Client.hpp
Go to the documentation of this file.
1#pragma once
2// Im not sure of how to do all of these things, so I'm freezing everything
3
4// #include <chrono>
5// #include <optional>
6// #include <variant>
7//
8// #include <Thoth/Http/NHeaders/Auth/_base.hpp>
9//
10// namespace Thoth::Http::NHeaders::Client {
11// using SString = std::string;
12//
13//
14// //! @brief RFC 7617 — The 'Basic' HTTP Authentication Scheme
15// //!
16// //! Decodes to base64(username:password).
17// struct BasicPayload {
18// std::string username;
19// std::string password;
20// };
21//
22// //! @brief RFC 6750 — The OAuth 2.0 Authorization Framework: Bearer Token Usage
23// //!
24// //! opaque bearer token.
25// struct BearerPayload {
26// SString token;
27// };
28//
29// //! @brief RFC 7616 — Digest Access Authentication Payload
30// //!
31// //! key=value pairs.
32// struct DigestPayload {
33// SString uri;
34// SString response;
35//
36// DigestAlgorithmEnum algorithm{ DigestAlgorithmEnum::Md5 };
37//
38// struct ChallengeEcho {
39// SString realm;
40// SString nonce;
41// std::optional<SString> opaque;
42// } echo;
43//
44// struct UserIdentity {
45// std::u8string username;
46// bool usesHash{};
47// } user;
48//
49// struct QualityOfProtection {
50// bool usesIntegrity;
51// SString cnonce;
52// uint32_t nc;
53// };
54//
55// std::optional<QualityOfProtection> protection;
56// };
57//
58// //! @brief RFC 7486 — HTTP Origin-Bound Authentication (HOBA)
59// //!
60// //! Digital-signature-based origin-bound auth.
61// struct HobaPayload {
62// struct ChallengeEcho {
63// SString challenge;
64// SString nonce;
65// std::optional<SString> realm;
66// } echo;
67//
68// struct KeyIdentity {
69// HobaKidTypeEnum type;
70// SString value;
71// std::optional<SString> pub;
72// };
73// std::optional<KeyIdentity> kid;
74//
75// struct DeviceIdentity {
76// HobaDidTypeEnum type;
77// SString value;
78// };
79// std::optional<DeviceIdentity> did;
80//
81// std::chrono::duration<uint32_t> maxAge{};
82// std::optional<SString> origin;
83// std::optional<uint8_t> result;
84//
85// uint16_t alg{};
86// SString sig;
87// };
88//
89// //! @brief RFC 8120 — Mutual Authentication Protocol for HTTP
90// //!
91// //! key=value pairs.
92// struct MutualPayload {
93// std::vector<std::pair<SString, SString>> params;
94// };
95//
96// //! @brief RFC 4559 — SPNEGO-based Kerberos and NTLM HTTP Authentication in Microsoft Windows
97// struct NegotiatePayload {
98// SString token;
99// };
100//
101// //! @brief RFC 8292 — Voluntary Application Server Identification (VAPID) for Web Push
102// struct VapidPayload {
103// //! @brief JWT signed by the application server.
104// SString token;
105// //! @brief raw base64url-encoded public key.
106// SString key;
107// };
108//
109// //! @brief RFC 7804 — Salted Challenge Response HTTP Authentication Mechanism
110// struct ScramPayload {
111// SString message;
112// };
113//
114// //! @brief AWS Signature Version 4
115// struct Aws4HmacSha256Payload {
116// SString algorithm;
117// SString accessKeyId;
118// SString credentialScope;
119// SString signedHeaders;
120// SString signature;
121// };
122//
123//
124// //! @brief Fallback for unknown/custom schemes
125// struct OtherPayload {
126// SString scheme;
127// SString payload;
128// };
129//
130//
131// //! @brief Class that deals with the auth-credentials.
132// struct AuthCredentials : std::variant<
133// BasicPayload,
134// BearerPayload,
135// DigestPayload,
136// HobaPayload,
137// MutualPayload,
138// NegotiatePayload,
139// VapidPayload,
140// ScramPayload,
141// Aws4HmacSha256Payload,
142// OtherPayload
143// > {
144// };
145// }
146//
147// #include <Thoth/Http/NHeaders/Auth/Client.tpp>