Represents the identity of the authenticated user based on JWT claims. More...
Header: | #include <ClientUserPayload> |
ClientUserPayload(const QVariantMap &claims) | |
QString | email() const |
QString | fullName() const |
bool | hasRole(const QString &role) const |
QString | id() const |
bool | isValid() const |
void | reset(const QVariantMap &claims) |
QStringList | roles() const |
QString | username() const |
This class stores decoded user information, such as user ID, username, email, and roles, extracted from a JWT payload. It is typically used in QML to check user identity and roles.
[read-only]
email : const QStringReturns the email address associated with the user.
Access functions:
QString | email() const |
[read-only]
fullName : const QStringReturns the user's full display name.
Access functions:
QString | fullName() const |
[read-only]
id : const QStringReturns the unique user ID ("sub" claim).
Access functions:
QString | id() const |
[read-only]
isValid : const boolReturns true
if the payload contains valid identity data (ID and username).
Access functions:
bool | isValid() const |
[read-only]
roles : const QStringListReturns the list of roles assigned to the user.
Access functions:
QStringList | roles() const |
[read-only]
username : const QStringReturns the preferred username.
Access functions:
QString | username() const |
[explicit]
ClientUserPayload::ClientUserPayload(const QVariantMap &claims)Constructs a ClientUserPayload from a parsed JWT claim map.
claims is the QVariantMap containing the decoded claims.
Returns true
if the user has the specified role.
Case-insensitive comparison is used.
Re-parses the internal state using new JWT claims.
claims is the new set of decoded JWT fields.