Molybden API
Loading...
Searching...
No Matches
cookie.hpp
1// Copyright (c) 2000-2023 TeamDev Ltd. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_COOKIE_HPP
6#define MOLYBDEN_COOKIE_HPP
7
8#include <chrono>
9#include <memory>
10#include <string>
11
12#include "molybden/time/timestamp.hpp"
13
14namespace molybden {
15
16using time = std::chrono::system_clock;
17
23enum class SameSite {
24 kUnspecified,
25
30 kStrictMode,
31
37 kLaxMode,
38
43 kNone,
44};
45
49struct Cookie {
50 explicit Cookie(
51 std::string domain,
52 std::string name = "",
53 std::string value = "",
54 std::string path = "",
55 bool is_secure = false,
56 bool is_http_only = false,
57 Timestamp creation_time = time::now().time_since_epoch().count(),
58 Timestamp expiration_time = 0,
59 SameSite same_site = SameSite::kLaxMode);
60
67 std::string domain;
68
72 std::string name;
73
78 std::string value;
79
84 std::string path;
85
91
98
106 Timestamp creation_time;
107
117
121 SameSite same_site;
122};
123
124} // namespace molybden
125
126#endif // MOLYBDEN_COOKIE_HPP