Web framework C++  2.0.0
Simple web framework on c++ designed to easily create web pages, etc
Public Member Functions | List of all members
CookieAuth Class Reference

Concrete cookie strategy of AuthStrategy. More...

#include <cookie_auth.h>

Inheritance diagram for CookieAuth:
Inheritance graph
Collaboration diagram for CookieAuth:
Collaboration graph

Public Member Functions

 CookieAuth (const char *secret, Middleware *cookie)
 
bool checkHeadersToParse (Headers *headers) override
 
std::string getSerializedValue (Headers *headers) override
 
void serializeAndSetValueToResponse (std::string &value) override
 
- Public Member Functions inherited from AuthStrategy
virtual ~AuthStrategy ()=default
 

Detailed Description

Concrete cookie strategy of AuthStrategy.

This class is implementation of authentication clients by using cookies, in which some serialized data of user is stored to recognize him in following requests. It uses sha5256 algorithm to sign data

Constructor & Destructor Documentation

CookieAuth::CookieAuth ( const char *  secret,
Middleware cookie 
)

Create Cookie Auth middleware

Parameters
secretsecret key used to sign data and prevent outside injections
cookieobject of cookie middleware to parse cookies

Member Function Documentation

bool CookieAuth::checkHeadersToParse ( Headers headers)
overridevirtual

Check, if there are any cookies with data of authenticated user

Parameters
headersheaders object
Returns
true, if this strategy should exec

Implements AuthStrategy.

std::string CookieAuth::getSerializedValue ( Headers headers)
overridevirtual

Get user serialized data

Parameters
headersheaders object
Returns
user serialized data

Implements AuthStrategy.

void CookieAuth::serializeAndSetValueToResponse ( std::string &  value)
overridevirtual

Sign serialized data and set both to response cookies

Parameters
valueserialized data of user

Implements AuthStrategy.


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