Implemented device code grant

This commit is contained in:
ErickSkrauch
2024-12-08 16:54:45 +01:00
parent c7d192d14e
commit 2cc27d34ad
28 changed files with 665 additions and 171 deletions

View File

@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace common\models;
use yii\behaviors\AttributeTypecastBehavior;
use yii\db\ActiveRecord;
/**
* Fields:
* @property string $device_code
* @property string $user_code
* @property string $client_id
* @property array $scopes
* @property int|null $account_id
* @property bool|null $is_approved
* @property int|null $last_polled_at
* @property int $expires_at
*
* Relations:
* @property-read OauthClient $client
*/
final class OauthDeviceCode extends ActiveRecord {
public static function tableName(): string {
return 'oauth_device_codes';
}
public function behaviors(): array {
return [
[
'class' => AttributeTypecastBehavior::class,
'attributeTypes' => [
'is_approved' => AttributeTypecastBehavior::TYPE_BOOLEAN,
],
'typecastAfterSave' => true,
'typecastAfterFind' => true,
],
];
}
public function getClient(): OauthClientQuery {
/** @noinspection PhpIncompatibleReturnTypeInspection */
return $this->hasOne(OauthClient::class, ['id' => 'client_id']);
}
}

View File

@@ -1,14 +0,0 @@
<?php
namespace common\models\amqp;
use yii\base\BaseObject;
class AccountBanned extends BaseObject {
public $accountId;
public $duration = -1;
public $message = '';
}

View File

@@ -1,10 +0,0 @@
<?php
namespace common\models\amqp;
use yii\base\BaseObject;
class AccountPardoned extends BaseObject {
public $accountId;
}

View File

@@ -1,14 +0,0 @@
<?php
namespace common\models\amqp;
use yii\base\BaseObject;
class EmailChanged extends BaseObject {
public $accountId;
public $oldEmail;
public $newEmail;
}

View File

@@ -1,14 +0,0 @@
<?php
namespace common\models\amqp;
use yii\base\BaseObject;
class UsernameChanged extends BaseObject {
public $accountId;
public $oldUsername;
public $newUsername;
}