1 | #ifndef CPR_AUTH_H |
---|---|
2 | #define CPR_AUTH_H |
3 | |
4 | #include <string> |
5 | |
6 | #include <utility> |
7 | |
8 | namespace cpr { |
9 | |
10 | enum class AuthMode { BASIC, DIGEST, NTLM }; |
11 | |
12 | class Authentication { |
13 | public: |
14 | Authentication(std::string username, std::string password, AuthMode auth_mode) : auth_string_{std::move(username) + ":"+ std::move(password)}, auth_mode_{std::move(auth_mode)} {} |
15 | Authentication(const Authentication& other) = default; |
16 | Authentication(Authentication&& old) noexcept = default; |
17 | ~Authentication() noexcept; |
18 | |
19 | Authentication& operator=(Authentication&& old) noexcept = default; |
20 | Authentication& operator=(const Authentication& other) = default; |
21 | |
22 | const char* GetAuthString() const noexcept; |
23 | AuthMode GetAuthMode() const noexcept; |
24 | |
25 | private: |
26 | std::string auth_string_; |
27 | AuthMode auth_mode_; |
28 | }; |
29 | |
30 | } // namespace cpr |
31 | |
32 | #endif |
33 |