remove "tymon/jwt-auth" package
This commit is contained in:
parent
4020571e53
commit
eae6ff887c
|
|
@ -25,7 +25,6 @@ class BsInstallCommand extends Command
|
|||
if (!$this->getLaravel()->runningUnitTests()) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$this->call('key:generate');
|
||||
$this->call('jwt:secret', ['--no-interaction' => true]);
|
||||
$this->call('passport:keys', ['--no-interaction' => true]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,26 +370,4 @@ class AuthController extends Controller
|
|||
|
||||
return redirect()->route('user.home');
|
||||
}
|
||||
|
||||
public function jwtLogin(Request $request)
|
||||
{
|
||||
$token = Auth::guard('jwt')->attempt([
|
||||
'email' => $request->input('email'),
|
||||
'password' => $request->input('password'),
|
||||
]) ?: '';
|
||||
|
||||
return json(compact('token'));
|
||||
}
|
||||
|
||||
public function jwtLogout()
|
||||
{
|
||||
Auth::guard('jwt')->logout();
|
||||
|
||||
return response('', 204);
|
||||
}
|
||||
|
||||
public function jwtRefresh()
|
||||
{
|
||||
return json(['token' => Auth::guard('jwt')->refresh()]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ class SetupController extends Controller
|
|||
'site_name' => 'required',
|
||||
]);
|
||||
|
||||
$artisan->call('jwt:secret', ['--no-interaction' => true]);
|
||||
$artisan->call('passport:keys', ['--no-interaction' => true]);
|
||||
|
||||
// Create tables
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
|
|||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
use Lorisleiva\LaravelSearchString\Concerns\SearchString;
|
||||
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||||
|
||||
/**
|
||||
* @property int $uid
|
||||
|
|
@ -28,7 +27,7 @@ use Tymon\JWTAuth\Contracts\JWTSubject;
|
|||
* @property Collection $players
|
||||
* @property Collection $closet
|
||||
*/
|
||||
class User extends Authenticatable implements JWTSubject
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
use HasFactory;
|
||||
|
|
@ -110,14 +109,4 @@ class User extends Authenticatable implements JWTSubject
|
|||
{
|
||||
return $this->uid;
|
||||
}
|
||||
|
||||
public function getJWTIdentifier()
|
||||
{
|
||||
return $this->getKey();
|
||||
}
|
||||
|
||||
public function getJWTCustomClaims()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
"symfony/process": "^5.0",
|
||||
"symfony/yaml": "^5.0",
|
||||
"twig/twig": "^2.11",
|
||||
"tymon/jwt-auth": "^1.0",
|
||||
"vectorface/whip": "^0.3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
|
|||
1015
composer.lock
generated
1015
composer.lock
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -2,20 +2,14 @@
|
|||
|
||||
Route::any('', 'HomeController@apiRoot');
|
||||
|
||||
Route::prefix('auth')->group(function () {
|
||||
Route::post('login', 'AuthController@jwtLogin');
|
||||
Route::post('logout', 'AuthController@jwtLogout')->middleware('auth:jwt');
|
||||
Route::post('refresh', 'AuthController@jwtRefresh')->middleware('auth:jwt');
|
||||
});
|
||||
|
||||
Route::prefix('user')->middleware('auth:jwt,oauth')->group(function () {
|
||||
Route::prefix('user')->middleware('auth:oauth')->group(function () {
|
||||
Route::get('', 'UserController@user');
|
||||
|
||||
Route::get('notifications', 'NotificationsController@all');
|
||||
Route::post('notifications/{id}', 'NotificationsController@read');
|
||||
});
|
||||
|
||||
Route::prefix('players')->middleware('auth:jwt,oauth')->group(function () {
|
||||
Route::prefix('players')->middleware('auth:oauth')->group(function () {
|
||||
Route::get('', 'PlayerController@list');
|
||||
Route::post('', 'PlayerController@add');
|
||||
Route::delete('{player}', 'PlayerController@delete');
|
||||
|
|
@ -24,7 +18,7 @@ Route::prefix('players')->middleware('auth:jwt,oauth')->group(function () {
|
|||
Route::delete('{player}/textures', 'PlayerController@clearTexture');
|
||||
});
|
||||
|
||||
Route::prefix('closet')->middleware('auth:jwt,oauth')->group(function () {
|
||||
Route::prefix('closet')->middleware('auth:oauth')->group(function () {
|
||||
Route::get('', 'ClosetController@getClosetData');
|
||||
Route::post('', 'ClosetController@add');
|
||||
Route::put('{tid}', 'ClosetController@rename');
|
||||
|
|
@ -32,7 +26,7 @@ Route::prefix('closet')->middleware('auth:jwt,oauth')->group(function () {
|
|||
});
|
||||
|
||||
Route::prefix('admin')
|
||||
->middleware(['auth:jwt,oauth', 'role:admin'])
|
||||
->middleware(['auth:oauth', 'role:admin'])
|
||||
->group(function () {
|
||||
Route::prefix('users')->group(function () {
|
||||
Route::get('', 'UsersManagementController@list')->name('list');
|
||||
|
|
|
|||
|
|
@ -758,51 +758,4 @@ class AuthControllerTest extends TestCase
|
|||
$this->post($url, ['email' => $user->email], ['Referer' => $url])
|
||||
->assertRedirect(route('user.home'));
|
||||
}
|
||||
|
||||
public function testApiLogin()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user->changePassword('12345678');
|
||||
|
||||
$this->postJson('/api/auth/login')->assertJson(['token' => '']);
|
||||
$token = $this->postJson('/api/auth/login', [
|
||||
'email' => $user->email,
|
||||
'password' => '12345678',
|
||||
])->json('token');
|
||||
$this->assertTrue(is_string($token));
|
||||
|
||||
$this->postJson('/api/auth/login', [
|
||||
'email' => $user->email,
|
||||
'password' => '123456789',
|
||||
])->assertJson(['token' => '']);
|
||||
}
|
||||
|
||||
public function testApiLogout()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user->changePassword('12345678');
|
||||
$token = $this->postJson('/api/auth/login', [
|
||||
'email' => $user->email,
|
||||
'password' => '12345678',
|
||||
])->json('token');
|
||||
|
||||
$this->post('/api/auth/logout', [], [
|
||||
'Authorization' => "Bearer $token",
|
||||
])->assertNoContent();
|
||||
}
|
||||
|
||||
public function testApiRefresh()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$user->changePassword('12345678');
|
||||
$token = $this->postJson('/api/auth/login', [
|
||||
'email' => $user->email,
|
||||
'password' => '12345678',
|
||||
])->json('token');
|
||||
|
||||
$token = $this->postJson('/api/auth/refresh', [], [
|
||||
'Authorization' => "Bearer $token",
|
||||
])->json('token');
|
||||
$this->assertTrue(is_string($token));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,9 +127,6 @@ class SetupControllerTest extends TestCase
|
|||
])->assertDontSee(trans('setup.wizard.finish.title'));
|
||||
|
||||
$this->spy(Artisan::class, function ($spy) {
|
||||
$spy->shouldReceive('call')
|
||||
->with('jwt:secret', ['--no-interaction' => true])
|
||||
->once();
|
||||
$spy->shouldReceive('call')
|
||||
->with('passport:keys', ['--no-interaction' => true])
|
||||
->once();
|
||||
|
|
|
|||
|
|
@ -19,14 +19,6 @@ class UserControllerTest extends TestCase
|
|||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function testUser()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user, 'jwt')
|
||||
->get('/api/user')
|
||||
->assertJson($user->toArray());
|
||||
}
|
||||
|
||||
public function testIndex()
|
||||
{
|
||||
$filter = Fakes\Filter::fake();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user