Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
accesstoken.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2024 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8#ifndef ACCSESTOKEN_H
9#define ACCSESTOKEN_H
10
11#include "streambase.h"
12
13#include <QByteArray>
14#include <QDateTime>
15#include <heart_global.h>
16
17namespace QH {
18
25{
26public:
27
31 enum Duration: int {
33 Second = 1,
35 Minute = 60 * Second,
37 Hour = 60 * Minute,
39 Day = 24 * Hour,
41 Week = 7 * Day,
43 Month = 30 * Day,
45 Year = 365 * Day,
46 };
47
53 explicit AccessToken(int duration, const QByteArray& entropy = "");
54
59 explicit AccessToken(const QByteArray& other);
60
64 explicit AccessToken();
65
70 AccessToken(const AccessToken& other);
71
76 bool isValid() const;
77
81 void clear();
82
88 bool operator == (const AccessToken& other) const;
89
95 bool operator != (const AccessToken& other) const;
96
102 AccessToken &operator =(const AccessToken& other);
103
104protected:
105 QDataStream &fromStream(QDataStream &stream);
106 QDataStream &toStream(QDataStream &stream) const;
107
108private:
109 QByteArray _data;
110 int _duration;
111
112 // StreamBase interface
113
114
115 QByteArray generate(const QByteArray &user);
116};
117
118}
119
120#endif // ACCSESTOKEN_H
The AccessToken class contains information duration of the access. Token are byte array for validatio...
Definition accesstoken.h:25
AccessToken(const AccessToken &other)
AccessToken copy constructor.
Duration
The Duration enum. This enum contains a long time unit.
Definition accesstoken.h:31
AccessToken()
AccessToken constructor by default create not valid token.
The StreamBase class add support streaming data for all children classes. For correctly working all s...
Definition streambase.h:28
#define HEARTSHARED_EXPORT
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13