libcex  1.0.0
Modern C++11 embedded webserver library
session.hpp
Go to the documentation of this file.
1 //*************************************************************************
2 // File session.hpp
3 // Date 24.04.2018
4 // Copyright (c) 2018-2019 by Patrick Fial
5 //-------------------------------------------------------------------------
6 // Session functions
7 //*************************************************************************
8 
9 #ifndef __SESSION_HPP__
10 #define __SESSION_HPP__
11 
22 //***************************************************************************
23 // includes
24 //***************************************************************************
25 
26 #include <string>
27 #include "core.hpp"
28 
29 namespace cex
30 {
31 
32 //**************************************************************************
33 // Middlewares
34 //***************************************************************************
35 // Session
36 //***************************************************************************
37 
65 {
66  SessionOptions() { name= "sessionId"; secure= false; httpOnly= true; secure= sameSiteStrict= sameSiteLax= false; expires= 0; maxAge= 0; }
67 
69  time_t expires;
70 
72  long maxAge;
73 
75  std::string domain;
76 
78  std::string path;
79 
81  std::string name;
82 
84  bool secure;
85 
87  bool httpOnly;
88 
91 
94 };
95 
103 MiddlewareFunction sessionHandler(std::shared_ptr<SessionOptions> opts = nullptr);
104 
105 
106 //***************************************************************************
107 } // namespace cex
108 
109 #endif // __SESSION_HPP_
std::string name
sets the name cookie option
Definition: session.hpp:81
bool sameSiteStrict
sets the same-site (strict) cookie option
Definition: session.hpp:90
std::string domain
Sets the domain cookie option.
Definition: session.hpp:75
time_t expires
Sets the expires cookie option. Must be a relative time offset in seconds.
Definition: session.hpp:69
bool sameSiteLax
sets the same-site (lax) cookie option
Definition: session.hpp:93
std::function< void(Request *req, Response *res, std::function< void()> next)> MiddlewareFunction
A function which is called by a standard Middleware when an incoming request matches.
Definition: core.hpp:108
bool httpOnly
sets the HTTP-only cookie option
Definition: session.hpp:87
bool secure
sets the secure cookie option
Definition: session.hpp:84
long maxAge
Sets the maxAge cookie option.
Definition: session.hpp:72
std::string path
sets the path cookie option
Definition: session.hpp:78
libcex core classes and functions
Contains all options for the sessionHandler middleware.
Definition: session.hpp:64