-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[13.x] Configure the user provider for PAT (#1768)
* add provider support for pat * fix tests * formatting * additional check
- Loading branch information
1 parent
0ee1d8b
commit ef640ef
Showing
6 changed files
with
148 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Laravel\Passport\Tests\Feature; | ||
|
||
use Illuminate\Foundation\Auth\User as Authenticatable; | ||
use Laravel\Passport\HasApiTokens; | ||
use Orchestra\Testbench\Concerns\WithLaravelMigrations; | ||
use Workbench\Database\Factories\UserFactory; | ||
|
||
class HasApiTokensTest extends PassportTestCase | ||
{ | ||
use WithLaravelMigrations; | ||
|
||
public function testGetProvider() | ||
{ | ||
config([ | ||
'auth.providers.admins' => ['driver' => 'eloquent', 'model' => AdminHasApiTokensStub::class], | ||
'auth.guards.api-admins' => ['driver' => 'passport', 'provider' => 'admins'], | ||
'auth.providers.customers' => ['driver' => 'database', 'table' => 'customer_has_api_tokens_stubs'], | ||
'auth.guards.api-customers' => ['driver' => 'passport', 'provider' => 'customers'], | ||
]); | ||
|
||
$this->assertSame('users', UserFactory::new()->create()->getProvider()); | ||
$this->assertSame('admins', (new AdminHasApiTokensStub)->getProvider()); | ||
$this->assertSame('customers', (new CustomerHasApiTokensStub)->getProvider()); | ||
} | ||
} | ||
|
||
class AdminHasApiTokensStub extends Authenticatable | ||
{ | ||
use HasApiTokens; | ||
} | ||
|
||
class CustomerHasApiTokensStub extends Authenticatable | ||
{ | ||
use HasApiTokens; | ||
} |
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