forked from laravel/laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial sanctum poc * add files * remove token
- Loading branch information
1 parent
236b318
commit 226d1bf
Showing
7 changed files
with
93 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Stateful Domains | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Requests from the following domains / hosts will receive stateful API | ||
| authentication cookies. Typically, these should include your local | ||
| and production domains which access your API via a frontend SPA. | ||
| | ||
*/ | ||
|
||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( | ||
'%s%s', | ||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', | ||
env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '' | ||
))), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Expiration Minutes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This value controls the number of minutes until an issued token will be | ||
| considered expired. If this value is null, personal access tokens do | ||
| not expire. This won't tweak the lifetime of first-party sessions. | ||
| | ||
*/ | ||
|
||
'expiration' => null, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Sanctum Middleware | ||
|-------------------------------------------------------------------------- | ||
| | ||
| When authenticating your first-party SPA with Sanctum you may need to | ||
| customize some of the middleware Sanctum uses while processing the | ||
| request. You may change the middleware listed below as required. | ||
| | ||
*/ | ||
|
||
'middleware' => [ | ||
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, | ||
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, | ||
], | ||
|
||
]; |
36 changes: 36 additions & 0 deletions
36
database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreatePersonalAccessTokensTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('personal_access_tokens', function (Blueprint $table) { | ||
$table->bigIncrements('id'); | ||
$table->morphs('tokenable'); | ||
$table->string('name'); | ||
$table->string('token', 64)->unique(); | ||
$table->text('abilities')->nullable(); | ||
$table->timestamp('last_used_at')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('personal_access_tokens'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters