2020-10-01 04:10:28 +05:30
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace common\notifications;
|
|
|
|
|
|
|
|
use common\models\OauthSession;
|
|
|
|
use Webmozart\Assert\Assert;
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
final readonly class OAuthSessionRevokedNotification implements NotificationInterface {
|
2020-10-01 04:10:28 +05:30
|
|
|
|
|
|
|
private OauthSession $oauthSession;
|
|
|
|
|
|
|
|
public function __construct(OauthSession $oauthSession) {
|
|
|
|
Assert::notNull($oauthSession->revoked_at, 'OAuth session must be revoked');
|
|
|
|
$this->oauthSession = $oauthSession;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getType(): string {
|
|
|
|
return 'oauth2.session_revoked';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPayloads(): array {
|
|
|
|
return [
|
|
|
|
'accountId' => $this->oauthSession->account_id,
|
|
|
|
'clientId' => $this->oauthSession->client_id,
|
|
|
|
'revoked' => date('c', $this->oauthSession->revoked_at),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|