remove sanctum package

This commit is contained in:
Alexis Gousseau 2023-02-22 17:14:09 +01:00
parent c9d988e64b
commit d454c83fec
7 changed files with 42 additions and 178 deletions

View file

@ -39,7 +39,6 @@ class Kernel extends HttpKernel
],
'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],

View file

@ -6,11 +6,10 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.

View file

@ -8,7 +8,6 @@
"php": "^8.1",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.0",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8"
},
"require-dev": {

144
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "121ea3a2fffe49b3ef9aa4d064b28c19",
"content-hash": "b1a27f510d8f5b1838a9f6611c1f3e02",
"packages": [
{
"name": "brick/math",
@ -983,16 +983,16 @@
},
{
"name": "laravel/framework",
"version": "v10.0.3",
"version": "v10.1.3",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "0bd303853444de33f4fcb16d13bd7574030aa3d4"
"reference": "12256504186326a9d02b2ab3b43a4031a59b52d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/0bd303853444de33f4fcb16d13bd7574030aa3d4",
"reference": "0bd303853444de33f4fcb16d13bd7574030aa3d4",
"url": "https://api.github.com/repos/laravel/framework/zipball/12256504186326a9d02b2ab3b43a4031a59b52d1",
"reference": "12256504186326a9d02b2ab3b43a4031a59b52d1",
"shasum": ""
},
"require": {
@ -1095,7 +1095,7 @@
"pda/pheanstalk": "^4.0",
"phpstan/phpdoc-parser": "^1.15",
"phpstan/phpstan": "^1.4.7",
"phpunit/phpunit": "^9.6.0 || ^10.0.7",
"phpunit/phpunit": "^10.0.7",
"predis/predis": "^2.0.2",
"symfony/cache": "^6.2",
"symfony/http-client": "^6.2.4"
@ -1126,7 +1126,7 @@
"mockery/mockery": "Required to use mocking (^1.5.1).",
"nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).",
"pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
"phpunit/phpunit": "Required to use assertions and run tests (^9.5.8).",
"phpunit/phpunit": "Required to use assertions and run tests (^9.5.8|^10.0.7).",
"predis/predis": "Required to use the predis connector (^2.0.2).",
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).",
@ -1179,72 +1179,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2023-02-16T22:03:27+00:00"
},
{
"name": "laravel/sanctum",
"version": "v3.2.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/sanctum.git",
"reference": "d09d69bac55708fcd4a3b305d760e673d888baf9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/sanctum/zipball/d09d69bac55708fcd4a3b305d760e673d888baf9",
"reference": "d09d69bac55708fcd4a3b305d760e673d888baf9",
"shasum": ""
},
"require": {
"ext-json": "*",
"illuminate/console": "^9.21|^10.0",
"illuminate/contracts": "^9.21|^10.0",
"illuminate/database": "^9.21|^10.0",
"illuminate/support": "^9.21|^10.0",
"php": "^8.0.2"
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/testbench": "^7.0|^8.0",
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
},
"laravel": {
"providers": [
"Laravel\\Sanctum\\SanctumServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Sanctum\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.",
"keywords": [
"auth",
"laravel",
"sanctum"
],
"support": {
"issues": "https://github.com/laravel/sanctum/issues",
"source": "https://github.com/laravel/sanctum"
},
"time": "2023-01-13T15:41:49+00:00"
"time": "2023-02-22T14:38:35+00:00"
},
{
"name": "laravel/serializable-closure",
@ -1308,16 +1243,16 @@
},
{
"name": "laravel/tinker",
"version": "v2.8.0",
"version": "v2.8.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/tinker.git",
"reference": "74d0b287cc4ae65d15c368dd697aae71d62a73ad"
"reference": "04a2d3bd0d650c0764f70bf49d1ee39393e4eb10"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/tinker/zipball/74d0b287cc4ae65d15c368dd697aae71d62a73ad",
"reference": "74d0b287cc4ae65d15c368dd697aae71d62a73ad",
"url": "https://api.github.com/repos/laravel/tinker/zipball/04a2d3bd0d650c0764f70bf49d1ee39393e4eb10",
"reference": "04a2d3bd0d650c0764f70bf49d1ee39393e4eb10",
"shasum": ""
},
"require": {
@ -1370,9 +1305,9 @@
],
"support": {
"issues": "https://github.com/laravel/tinker/issues",
"source": "https://github.com/laravel/tinker/tree/v2.8.0"
"source": "https://github.com/laravel/tinker/tree/v2.8.1"
},
"time": "2023-01-10T18:03:30+00:00"
"time": "2023-02-15T16:40:09+00:00"
},
{
"name": "league/commonmark",
@ -5601,16 +5536,16 @@
},
{
"name": "laravel/pint",
"version": "v1.5.0",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/pint.git",
"reference": "e0a8cef58b74662f27355be9cdea0e726bbac362"
"reference": "e48e3fadd7863d6b7d03464f5c4f211a828b890f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/e0a8cef58b74662f27355be9cdea0e726bbac362",
"reference": "e0a8cef58b74662f27355be9cdea0e726bbac362",
"url": "https://api.github.com/repos/laravel/pint/zipball/e48e3fadd7863d6b7d03464f5c4f211a828b890f",
"reference": "e48e3fadd7863d6b7d03464f5c4f211a828b890f",
"shasum": ""
},
"require": {
@ -5618,12 +5553,12 @@
"ext-mbstring": "*",
"ext-tokenizer": "*",
"ext-xml": "*",
"php": "^8.0"
"php": "^8.1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.14.4",
"illuminate/view": "^9.51.0",
"laravel-zero/framework": "^9.2.0",
"illuminate/view": "^10.0.0",
"laravel-zero/framework": "^10.0.0",
"mockery/mockery": "^1.5.1",
"nunomaduro/larastan": "^2.4.0",
"nunomaduro/termwind": "^1.15.1",
@ -5663,20 +5598,20 @@
"issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint"
},
"time": "2023-02-14T16:31:02+00:00"
"time": "2023-02-21T15:44:57+00:00"
},
{
"name": "laravel/sail",
"version": "v1.20.2",
"version": "v1.21.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/sail.git",
"reference": "5ae072b182b1efbec927409e8a3ce3b1078cc42c"
"reference": "758a914fc4da41f3f6ca5522c85902181b228bd1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/sail/zipball/5ae072b182b1efbec927409e8a3ce3b1078cc42c",
"reference": "5ae072b182b1efbec927409e8a3ce3b1078cc42c",
"url": "https://api.github.com/repos/laravel/sail/zipball/758a914fc4da41f3f6ca5522c85902181b228bd1",
"reference": "758a914fc4da41f3f6ca5522c85902181b228bd1",
"shasum": ""
},
"require": {
@ -5724,7 +5659,7 @@
"issues": "https://github.com/laravel/sail/issues",
"source": "https://github.com/laravel/sail"
},
"time": "2023-02-08T20:22:21+00:00"
"time": "2023-02-16T19:16:27+00:00"
},
{
"name": "mockery/mockery",
@ -6380,16 +6315,16 @@
},
{
"name": "phpunit/phpunit",
"version": "10.0.9",
"version": "10.0.11",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "b027e0e266b2e51bb74d5050ff5b1304c40ea209"
"reference": "d18a18b07e7a9ad52d994b1785f9e301fc84b616"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b027e0e266b2e51bb74d5050ff5b1304c40ea209",
"reference": "b027e0e266b2e51bb74d5050ff5b1304c40ea209",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d18a18b07e7a9ad52d994b1785f9e301fc84b616",
"reference": "d18a18b07e7a9ad52d994b1785f9e301fc84b616",
"shasum": ""
},
"require": {
@ -6460,7 +6395,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.9"
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.11"
},
"funding": [
{
@ -6476,7 +6411,7 @@
"type": "tidelift"
}
],
"time": "2023-02-19T07:11:46+00:00"
"time": "2023-02-20T16:39:36+00:00"
},
{
"name": "sebastian/cli-parser",
@ -7388,16 +7323,16 @@
},
{
"name": "spatie/backtrace",
"version": "1.2.1",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/backtrace.git",
"reference": "4ee7d41aa5268107906ea8a4d9ceccde136dbd5b"
"reference": "7b34fee6c1ad45f8ee0498d17cd8ea9a076402c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/backtrace/zipball/4ee7d41aa5268107906ea8a4d9ceccde136dbd5b",
"reference": "4ee7d41aa5268107906ea8a4d9ceccde136dbd5b",
"url": "https://api.github.com/repos/spatie/backtrace/zipball/7b34fee6c1ad45f8ee0498d17cd8ea9a076402c1",
"reference": "7b34fee6c1ad45f8ee0498d17cd8ea9a076402c1",
"shasum": ""
},
"require": {
@ -7433,8 +7368,7 @@
"spatie"
],
"support": {
"issues": "https://github.com/spatie/backtrace/issues",
"source": "https://github.com/spatie/backtrace/tree/1.2.1"
"source": "https://github.com/spatie/backtrace/tree/1.2.2"
},
"funding": [
{
@ -7446,7 +7380,7 @@
"type": "other"
}
],
"time": "2021-11-09T10:57:15+00:00"
"time": "2023-02-21T08:29:12+00:00"
},
{
"name": "spatie/flare-client-php",

View file

@ -15,7 +15,7 @@ return [
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'paths' => ['api/*'],
'allowed_methods' => ['*'],

View file

@ -1,67 +0,0 @@
<?php
use Laravel\Sanctum\Sanctum;
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',
Sanctum::currentApplicationUrlWithPort()
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| 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,
],
];

View file

@ -14,6 +14,6 @@ use Illuminate\Support\Facades\Route;
|
*/
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
Route::get('/user', function (Request $request) {
return $request->user();
});