Skip to content

AuthManager

#include <mrx/spoke-zone/auth/AuthManager.hpp>
class mrx::spokezone::AuthManager

Inherits: QObject

Checks and refreshes the configured Spoke.Zone device token.

The configuration and authentication API are caller-owned and must outlive this manager. Call start() to perform an immediate expiry check and maintain the next check automatically. checkRefresh() can also be used to manually check immediately without enabling automatic scheduling.

ReturnNameDescription
AuthManager explicit
AuthManagerConstructs a manager with an explicitly supplied CPU ID.
~AuthManager override
voidstartStarts automatic expiry checks and immediately checks the current token.
voidstopStops scheduled checks and cancels an in-flight authentication request.

explicit
explicit AuthManager(SpokeZoneConfig& config, AuthenticationApi& authenticationApi, QObject* parent = nullptr)

AuthManager(SpokeZoneConfig& config, AuthenticationApi& authenticationApi, const QString& cpuId, QObject* parent)

Constructs a manager with an explicitly supplied CPU ID.

This overload supports platforms that provide the hardware identifier themselves and allows host-side integrations to exercise the authentication flow.


override
~AuthManager() override

void start()

Starts automatic expiry checks and immediately checks the current token.


void stop()

Stops scheduled checks and cancels an in-flight authentication request.

ReturnNameDescription
voidtokenUpdatedEmitted after a refreshed token has been persisted to configuration.
voidrefreshFailedEmitted when a refresh check fails.
voidrefreshCheckScheduledEmitted whenever the next automatic check or retry is scheduled.

void tokenUpdated()

Emitted after a refreshed token has been persisted to configuration.


void refreshFailed(const QString& reason)

Emitted when a refresh check fails.

The diagnostic never includes token values.


void refreshCheckScheduled(const QDateTime& checkAt)

Emitted whenever the next automatic check or retry is scheduled.

ReturnNameDescription
voidcheckRefreshChecks the current token immediately, refreshing it only when it reaches the refresh window.

void checkRefresh()

Checks the current token immediately, refreshing it only when it reaches the refresh window.