Adam Pippin
3 years ago
11 changed files with 130 additions and 144 deletions
@ -0,0 +1,35 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Database\Migrations\Migration; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Support\Facades\Schema; |
|||
|
|||
class Authkit2Token extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
// These are split up like this as to not cause issues when running |
|||
// against sqlite. |
|||
Schema::create('authkit2_token', static function(Blueprint $table) { |
|||
$table->text('id')->unique(); |
|||
$table->foreignId('user_id')->constrained('users'); |
|||
$table->text('access_token'); |
|||
$table->text('refresh_token'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::drop('authkit2_token'); |
|||
} |
|||
} |
@ -1,9 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace authkit2\Models; |
|||
|
|||
interface IAuthkitUser |
|||
{ |
|||
public function getAccessTokenName(): string; |
|||
public function getRefreshTokenName(): string; |
|||
} |
@ -0,0 +1,20 @@ |
|||
<?php |
|||
|
|||
namespace authkit2\Models; |
|||
|
|||
use \Illuminate\Database\Eloquent\Model; |
|||
|
|||
/** |
|||
* User's OIDC token |
|||
* |
|||
* @property string id |
|||
* @property int user_id |
|||
* @property string access_token |
|||
* @property string refresh_token |
|||
*/ |
|||
class Token extends Model |
|||
{ |
|||
protected $table = 'authkit2_token'; |
|||
public $timestamps = false; |
|||
|
|||
} |
@ -1,29 +0,0 @@ |
|||
<?php |
|||
|
|||
declare(strict_types=1); |
|||
|
|||
namespace authkit2\Models; |
|||
|
|||
use Illuminate\Foundation\Auth\User as Authenticatable; |
|||
|
|||
/** |
|||
* Sample user model compatible with authkit |
|||
*/ |
|||
class User extends Authenticatable |
|||
{ |
|||
/** @var string[] */ |
|||
protected $fillable = [ |
|||
'name', |
|||
'email' |
|||
]; |
|||
|
|||
/** @var string[] */ |
|||
protected $hidden = [ |
|||
'remember_token' |
|||
]; |
|||
|
|||
public function getAuthIdentifierName() |
|||
{ |
|||
return 'authkit_id'; |
|||
} |
|||
} |
Loading…
Reference in new issue