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 <string>
10
11#include "molybden/time/timestamp.hpp"
12
13namespace molybden {
14
15using time = std::chrono::system_clock;
16
22enum class SameSite {
23 kUnspecified,
24
29 kStrictMode,
30
36 kLaxMode,
37
42 kNone,
43};
44
48struct Cookie {
49 explicit Cookie(
50 std::string domain,
51 std::string name = "",
52 std::string value = "",
53 std::string path = "/",
54 bool is_secure = false,
55 bool is_http_only = false,
56 Timestamp creation_time = time::now().time_since_epoch().count(),
57 Timestamp expiration_time = 0,
58 SameSite same_site = SameSite::kLaxMode);
59
66 std::string domain;
67
71 std::string name;
72
77 std::string value;
78
83 std::string path = "/";
84
90
97
105 Timestamp creation_time;
106
116
120 SameSite same_site;
121};
122
123} // namespace molybden
124
125#endif // MOLYBDEN_COOKIE_HPP