Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
accesstoken.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2018-2025 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
17
namespace
QH
{
18
24
class
HEARTSHARED_EXPORT
AccessToken
:
public
StreamBase
25
{
26
public
:
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
104
protected
:
105
QDataStream &
fromStream
(QDataStream &stream);
106
QDataStream &
toStream
(QDataStream &stream)
const
;
107
108
private
:
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
QH::AccessToken
The AccessToken class contains information duration of the access. Token are byte array for validatio...
Definition
accesstoken.h:25
QH::AccessToken::toStream
QDataStream & toStream(QDataStream &stream) const
fromStream This method should be write all members of the current object to the stream object.
Definition
accesstoken.cpp:68
QH::AccessToken::AccessToken
AccessToken(const AccessToken &other)
AccessToken copy constructor.
QH::AccessToken::fromStream
QDataStream & fromStream(QDataStream &stream)
fromStream This method should be read all bytes from the stream object and full the current object.
Definition
accesstoken.cpp:61
QH::AccessToken::AccessToken
AccessToken(int duration, const QByteArray &entropy="")
AccessToken This constructor create token on duration (in seconds).
Definition
accesstoken.cpp:27
QH::AccessToken::isValid
bool isValid() const
isValid This method check this toke to valid.
Definition
accesstoken.cpp:40
QH::AccessToken::clear
void clear()
clearThis Method reset all data of token.
Definition
accesstoken.cpp:45
QH::AccessToken::Duration
Duration
The Duration enum. This enum contains a long time unit.
Definition
accesstoken.h:31
QH::AccessToken::Minute
@ Minute
The one minute.
Definition
accesstoken.h:35
QH::AccessToken::Week
@ Week
The one Week.
Definition
accesstoken.h:41
QH::AccessToken::Month
@ Month
The one Month.
Definition
accesstoken.h:43
QH::AccessToken::Day
@ Day
The one day.
Definition
accesstoken.h:39
QH::AccessToken::Second
@ Second
The one second.
Definition
accesstoken.h:33
QH::AccessToken::Year
@ Year
The one year.
Definition
accesstoken.h:45
QH::AccessToken::Hour
@ Hour
The one hour.
Definition
accesstoken.h:37
QH::AccessToken::AccessToken
AccessToken()
AccessToken constructor by default create not valid token.
QH::StreamBase::StreamBase
StreamBase()
QH
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition
heart.cpp:13
streambase.h
src
public
accesstoken.h
Generated by
1.18.0