RefreshTokenStore
RefreshTokenStore
Hazaar\Auth\Interface\DeviceAwareRefreshTokenStore implementation backed by Hazaar\Cache\Adapter, which already
class RefreshTokenStore implements \Hazaar\Auth\Interface\DeviceAwareRefreshTokenStoreImplements: Hazaar\Auth\Interface\DeviceAwareRefreshTokenStore
supports apc/redis/memcached/file/shm/session backends via the app's cache config.
Suited to horizontally-scaled deployments (multiple app instances behind a load balancer) that already run a shared cache backend (redis/memcached) -- unlike Hazaar\Auth\Store\File\RefreshTokenStore (the framework default), a token minted by one instance stays redeemable via any other instance sharing the same backend.
Tokens are hashed with SHA-256 before storage and lookup -- the plaintext value is never persisted, the same way a password would be handled.
Configured via a Hazaar\Auth\Session\Backend\JWT backend's refresh_tokens_options -- see Hazaar\Auth\Store\Cache\RefreshTokenStore\Options for the available keys.
Constants
INDEX_TTL
private const INDEX_TTL = 60Properties
cache
private CacheAdapter $cacheType: Hazaar\Cache\Adapter
Methods
__construct
public __construct(array|Options $config): voidParameters
| Parameter | Type | Description |
|---|---|---|
$config | array | Hazaar\Auth\Store\Cache\RefreshTokenStore\Options |
save
public save(RefreshToken $token): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | Hazaar\Auth\RefreshToken |
consume
public consume(string $token): ?RefreshTokenReturns: Hazaar\Auth\RefreshToken
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | string |
revoke
public revoke(string $token): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | string |
revokeAll
public revokeAll(string $identity): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string |
listDevices
public listDevices(string $identity): arrayReturns: array
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string |
revokeDevice
public revokeDevice(string $identity, string $sessionId): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string | |
$sessionId | string |
toRecord
private toRecord(RefreshToken $token): arrayReturns: array
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | Hazaar\Auth\RefreshToken |
fromRecord
private fromRecord(string $token, array $record): RefreshTokenReturns: Hazaar\Auth\RefreshToken
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | string | |
$record | array |
hydrateDeviceInfo
private hydrateDeviceInfo(mixed $data): ?DeviceInfoReturns: Hazaar\Auth\DeviceInfo
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed |
tokenKey
private tokenKey(string $token): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | string |
indexKey
private indexKey(string $identity): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string |
indexKeys
private indexKeys(string $indexKey): arrayReturns: array
Parameters
| Parameter | Type | Description |
|---|---|---|
$indexKey | string |
indexAdd
private indexAdd(string $identity, string $tokenKey): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string | |
$tokenKey | string |
indexRemove
private indexRemove(string $identity, string $tokenKey): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string | |
$tokenKey | string |
Generated by Hazaar API Doc Generator on Sun, 23 Aug 2026 10:49:44 +0000