#include <cookie.hpp>
|
static std::unordered_map< std::string, std::string > | parseCookies (std::string const &cookieHeaderEntry) |
|
A Cookie helper class that contains Cookie data and provides utilitarian functions.
◆ Cookie() [1/2]
Creates a fresh session Cookie.
◆ Cookie() [2/2]
Roar::Cookie::Cookie |
( |
std::string const & |
name, |
|
|
std::string const & |
value |
|
) |
| |
|
explicit |
Create a Cookie, setting only name and value.
◆ getDomain()
std::string Roar::Cookie::getDomain |
( |
| ) |
const |
Returns the domain attribution.
◆ getMaxAge()
uint64_t Roar::Cookie::getMaxAge |
( |
| ) |
const |
Get the maximum age of the Cookie.
◆ getName()
std::string Roar::Cookie::getName |
( |
| ) |
const |
◆ getPath()
std::string Roar::Cookie::getPath |
( |
| ) |
const |
Returns the path attribution.
◆ getSameSite()
std::string Roar::Cookie::getSameSite |
( |
| ) |
const |
◆ getValue()
std::string Roar::Cookie::getValue |
( |
| ) |
const |
◆ isHttpOnly()
bool Roar::Cookie::isHttpOnly |
( |
| ) |
const |
Returns whether the Cookie is "HttpOnly" or not.
◆ isSecure()
bool Roar::Cookie::isSecure |
( |
| ) |
const |
Returns whether the Cookie is secure or not.
◆ makeSessionCookie()
Cookie & Roar::Cookie::makeSessionCookie |
( |
| ) |
|
Removes the expiration date. All cookies are session cookies after creation, so no need to call this for fresh cookies.
◆ parseCookies()
std::unordered_map< std::string, std::string > Roar::Cookie::parseCookies |
( |
std::string const & |
cookieHeaderEntry | ) |
|
|
static |
Parses a Cookie request header entry and makes a Cookie from it.
◆ setDomain()
Cookie & Roar::Cookie::setDomain |
( |
std::string const & |
domain | ) |
|
Set the Domain attribute of the Cookie.
◆ setExpiry()
Cookie & Roar::Cookie::setExpiry |
( |
date const & |
expires | ) |
|
◆ setHttpOnly()
Cookie & Roar::Cookie::setHttpOnly |
( |
bool |
http_only | ) |
|
Set whether or not, the Cookie shall be accessible by scripting languages. This feature implemented by some browsers reduces XSS vulnerability.
- Parameters
-
http_only | The Cookie will not be accessible by JavaScript etc when true. |
◆ setMaxAge()
Cookie & Roar::Cookie::setMaxAge |
( |
uint64_t |
age | ) |
|
Set the max age attribute of the cookie.
◆ setName()
Cookie & Roar::Cookie::setName |
( |
std::string const & |
name | ) |
|
◆ setPath()
Cookie & Roar::Cookie::setPath |
( |
std::string const & |
path | ) |
|
Set the path on which the Cookie shall be accessible from.
◆ setSameSite()
Cookie & Roar::Cookie::setSameSite |
( |
std::string const & |
same_site | ) |
|
◆ setSecure()
Cookie & Roar::Cookie::setSecure |
( |
bool |
secure | ) |
|
Set whether or not the Cookie shall be a secure Cookie.
- Parameters
-
secure | The Cookie will only be used over HTTPS if true. |
◆ setValue()
Cookie & Roar::Cookie::setValue |
( |
std::string const & |
value | ) |
|
◆ toSetCookieString()
std::string Roar::Cookie::toSetCookieString |
( |
| ) |
const |
◆ domain_
std::string Roar::Cookie::domain_ |
|
private |
◆ expires_
boost::optional<date> Roar::Cookie::expires_ |
|
private |
◆ httpOnly_
bool Roar::Cookie::httpOnly_ |
|
private |
◆ maxAge_
uint64_t Roar::Cookie::maxAge_ |
|
private |
◆ name_
std::string Roar::Cookie::name_ |
|
private |
◆ path_
std::string Roar::Cookie::path_ |
|
private |
◆ sameSite_
std::string Roar::Cookie::sameSite_ |
|
private |
◆ secure_
bool Roar::Cookie::secure_ |
|
private |
◆ value_
std::string Roar::Cookie::value_ |
|
private |
The documentation for this class was generated from the following files: