libcex  1.0.0
Modern C++11 embedded webserver library
Public Attributes | List of all members
cex::SessionOptions Struct Reference

Contains all options for the sessionHandler middleware. More...

#include <session.hpp>

Public Attributes

time_t expires
 Sets the expires cookie option. Must be a relative time offset in seconds.
 
long maxAge
 Sets the maxAge cookie option.
 
std::string domain
 Sets the domain cookie option.
 
std::string path
 sets the path cookie option
 
std::string name
 sets the name cookie option
 
bool secure
 sets the secure cookie option
 
bool httpOnly
 sets the HTTP-only cookie option
 
bool sameSiteStrict
 sets the same-site (strict) cookie option
 
bool sameSiteLax
 sets the same-site (lax) cookie option
 

Detailed Description

Contains all options for the sessionHandler middleware.

Example:

std::shared_ptr<cex::SessionOptions> opts(new cex::SessionOptions());
opts.get()->expires = 60*60*24*3;
opts.get()->maxAge= 144;
opts.get()->domain= "my.domain.de";
opts.get()->path= "/somePath";
opts.get()->name= "sessionID";
opts.get()->secure= false;
opts.get()->httpOnly=true;
opts.get()->sameSiteLax= true;
opts.get()->sameSiteStrict= true;
app.use(cex::sessionHandler(opts));

will set the following cookie:

Set-Cookie: sessionID=D7D1AB0E9B41E9291933C28DB7110A8B6C01B47D13EF82D712676E12AFF97A85; Domain=my.domain.de; Path=/somePath; Expires=Sun, 10 Feb 2019 08:54:31 CET; Max-Age=144; HttpOnly; SameSite=Strict

The documentation for this struct was generated from the following file: