mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Реорганизована выдача JWT токенов
Добавлен механизм сохранения сессий и refresh_token
This commit is contained in:
24
console/migrations/m160517_151805_account_sessions.php
Normal file
24
console/migrations/m160517_151805_account_sessions.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use console\db\Migration;
|
||||
|
||||
class m160517_151805_account_sessions extends Migration {
|
||||
|
||||
public function safeUp() {
|
||||
$this->createTable('{{%accounts_sessions}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'account_id' => $this->db->getTableSchema('{{%accounts}}')->getColumn('id')->dbType . ' NOT NULL',
|
||||
'refresh_token' => $this->string()->notNull()->unique(),
|
||||
'last_used_ip' => $this->integer()->unsigned()->notNull(),
|
||||
'created_at' => $this->integer()->notNull(),
|
||||
'last_refreshed_at' => $this->integer()->notNull(),
|
||||
], $this->tableOptions);
|
||||
|
||||
$this->addForeignKey('FK_account_session_to_account', '{{%accounts_sessions}}', 'account_id', '{{%accounts}}', 'id', 'CASCADE', 'CASCADE');
|
||||
}
|
||||
|
||||
public function safeDown() {
|
||||
$this->dropTable('{{%accounts_sessions}}');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user