• ClientUserPayload
  • ClientUserPayload Class

    Represents the identity of the authenticated user based on JWT claims. More...

    Header: #include <ClientUserPayload>

    Properties

    Public Functions

    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

    Detailed Description

    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.

    Property Documentation

    [read-only] email : const QString

    Returns the email address associated with the user.

    Access functions:

    QString email() const

    [read-only] fullName : const QString

    Returns the user's full display name.

    Access functions:

    QString fullName() const

    [read-only] id : const QString

    Returns the unique user ID ("sub" claim).

    Access functions:

    QString id() const

    [read-only] isValid : const bool

    Returns true if the payload contains valid identity data (ID and username).

    Access functions:

    bool isValid() const

    [read-only] roles : const QStringList

    Returns the list of roles assigned to the user.

    Access functions:

    QStringList roles() const

    [read-only] username : const QString

    Returns the preferred username.

    Access functions:

    QString username() const

    Member Function Documentation

    [explicit] ClientUserPayload::ClientUserPayload(const QVariantMap &claims)

    Constructs a ClientUserPayload from a parsed JWT claim map.

    claims is the QVariantMap containing the decoded claims.

    bool ClientUserPayload::hasRole(const QString &role) const

    Returns true if the user has the specified role.

    Case-insensitive comparison is used.

    void ClientUserPayload::reset(const QVariantMap &claims)

    Re-parses the internal state using new JWT claims.

    claims is the new set of decoded JWT fields.