TimestampBehavior::class, 'updatedAtAttribute' => false, ], ]; } /** * There are 2 ways to revoke tokens: * 1. By setting revoked_at time. * 2. By completely removing the session record. * * For the second case we need to ensure, that the validated token is not before the latest existing session. */ public function isRevokedForTokenIssuedAt(DateTimeInterface $issuedAt): bool { $issuedAt = $issuedAt->getTimestamp(); if ($issuedAt < $this->created_at) { return true; } return $this->revoked_at !== null && $this->revoked_at > $issuedAt; } public function getClient(): ActiveQuery { return $this->hasOne(OauthClient::class, ['id' => 'client_id']); } public function getAccount(): ActiveQuery { return $this->hasOne(Account::class, ['id' => 'account_id']); } /** * Previously the RBAC permissions names were stored instead of the public scopes names. * Since there are too many rows to migrate them, the scopes are normalized on read * and will be stored in the normalized form on the next session update. * * @return list */ public function getScopes(): array { return ScopesMapper::normalizeScopes((array)$this->scopes); } }