Heart 1.3.848.aa44c26
Heart is base back end library for your c++ Qt projects.
|
The AccessToken class contains information duration of the access. Token are byte array for validation access users or another network member on nodes. In usually cases toke add permissions for database objects. More...
#include <accesstoken.h>
Public Types | |
enum | Duration : int { Second = 1 , Minute = 60 * Second , Hour = 60 * Minute , Day = 24 * Hour , Week = 7 * Day , Month = 30 * Day , Year = 365 * Day } |
The Duration enum. This enum contains a long time unit. More... | |
Public Member Functions | |
AccessToken (int duration, const QByteArray &entropy="") | |
AccessToken This constructor create token on duration (in seconds). | |
AccessToken (const QByteArray &other) | |
AccessToken - Create token from bytes array of another token. | |
AccessToken () | |
AccessToken constructor by default create not valid token. | |
AccessToken (const AccessToken &other) | |
AccessToken copy constructor. | |
bool | isValid () const |
isValid This method check this toke to valid. | |
void | clear () |
clearThis Method reset all data of token. | |
bool | operator== (const AccessToken &other) const |
operator == compare left and right values with type AccessToken. | |
bool | operator!= (const AccessToken &other) const |
operator != compare left and right values with type AccessToken. | |
AccessToken & | operator= (const AccessToken &other) |
operator = this is operator of copy objects. | |
Public Member Functions inherited from QH::StreamBase | |
StreamBase () | |
virtual | ~StreamBase () |
bool | fromBytes (const QByteArray &data) |
fromBytes This method provide initialization of object from byte array. | |
QByteArray | toBytes () const |
toBytes This method convert a current object to bytes array. | |
bool | fromBase64 (const QString &data) |
fromBase64 This method provide initialization of object from the base64 string. | |
bool | fromBase64 (const QByteArray &data) |
fromBase64 This method provide initialization of object from the base64 string. | |
QByteArray | toBase64 () const |
toBase64 This method convert a current object to the base64 string. | |
template<class T > | |
T & | copy (const StreamBase &right) |
copy This is base copy method for all StreamBase structures. Default implementation it is copy from byteArray. | |
template<class T > | |
bool | compare (const T &right) |
compare This method compare array signatures of this and right objects. | |
Protected Member Functions | |
QDataStream & | fromStream (QDataStream &stream) |
fromStream This method should be read all bytes from the stream object and full the current object. | |
QDataStream & | toStream (QDataStream &stream) const |
fromStream This method should be write all members of the current object to the stream object. | |
Protected Member Functions inherited from QH::StreamBase | |
virtual int | parsingVersion () const |
parsingVersion this method return parsing version of Qt. By Default is 0 (last available parsing). see https://doc.qt.io/qt-6/qdatastream.html#Version-enum | |
virtual unsigned int | typeId () const |
typeId This method return id of type. | |
The AccessToken class contains information duration of the access. Token are byte array for validation access users or another network member on nodes. In usually cases toke add permissions for database objects.
Definition at line 24 of file accesstoken.h.
enum QH::AccessToken::Duration : int |
The Duration enum. This enum contains a long time unit.
Enumerator | |
---|---|
Second | The one second. |
Minute | The one minute. |
Hour | The one hour. |
Day | The one day. |
Week | The one Week. |
Month | The one Month. |
Year | The one year. |
Definition at line 31 of file accesstoken.h.
|
explicit |
AccessToken This constructor create token on duration (in seconds).
duration | This is value in seconds. |
entropy | This is random bytes array for generate token. By Default is empty string. |
Definition at line 27 of file accesstoken.cpp.
|
explicit |
AccessToken - Create token from bytes array of another token.
other | This is bytes array of another token value. |
Definition at line 32 of file accesstoken.cpp.
|
explicitdefault |
AccessToken constructor by default create not valid token.
|
default |
AccessToken copy constructor.
other |
void QH::AccessToken::clear | ( | ) |
clearThis Method reset all data of token.
Definition at line 45 of file accesstoken.cpp.
|
protectedvirtual |
fromStream This method should be read all bytes from the stream object and full the current object.
stream | This is Qt stream object. |
Examle of base simple implementation:
Implements QH::StreamBase.
Definition at line 61 of file accesstoken.cpp.
bool QH::AccessToken::isValid | ( | ) | const |
isValid This method check this toke to valid.
Definition at line 40 of file accesstoken.cpp.
bool QH::AccessToken::operator!= | ( | const AccessToken & | other | ) | const |
operator != compare left and right values with type AccessToken.
other | This is another object of the AccessTokens. |
Definition at line 55 of file accesstoken.cpp.
|
default |
operator = this is operator of copy objects.
other |
bool QH::AccessToken::operator== | ( | const AccessToken & | other | ) | const |
operator == compare left and right values with type AccessToken.
other | This is another object of the AccessTokens. |
Definition at line 51 of file accesstoken.cpp.
|
protectedvirtual |
fromStream This method should be write all members of the current object to the stream object.
stream | This is Qt stream object. |
Examle of base simple implementation:
Implements QH::StreamBase.
Definition at line 68 of file accesstoken.cpp.