Skip to content

Commit 48a03ff

Browse files
authored
Revert "[11.x] Add Provider Guard to ClientRepository for Personal Access Clients (#1655)" (#1658)
This reverts commit a75f0a9.
1 parent 487f183 commit 48a03ff

File tree

3 files changed

+11
-24
lines changed

3 files changed

+11
-24
lines changed

src/ClientRepository.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,11 @@ public function create($userId, $name, $redirect, $provider = null, $personalAcc
161161
* @param int|null $userId
162162
* @param string $name
163163
* @param string $redirect
164-
* @param string|null $provider
165164
* @return \Laravel\Passport\Client
166165
*/
167-
public function createPersonalAccessClient($userId, $name, $redirect, $provider = null)
166+
public function createPersonalAccessClient($userId, $name, $redirect)
168167
{
169-
return tap($this->create($userId, $name, $redirect, $provider, true), function ($client) {
168+
return tap($this->create($userId, $name, $redirect, null, true), function ($client) {
170169
$accessClient = Passport::personalAccessClient();
171170
$accessClient->client_id = $client->getKey();
172171
$accessClient->save();

src/Console/ClientCommand.php

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ protected function createPersonalClient(ClientRepository $clients)
6363
config('app.name').' Personal Access Client'
6464
);
6565

66-
$provider = $this->promptForProvider();
67-
6866
$client = $clients->createPersonalAccessClient(
69-
null, $name, 'http://localhost', $provider
67+
null, $name, 'http://localhost'
7068
);
7169

7270
$this->info('Personal access client created successfully.');
@@ -87,7 +85,13 @@ protected function createPasswordClient(ClientRepository $clients)
8785
config('app.name').' Password Grant Client'
8886
);
8987

90-
$provider = $this->promptForProvider();
88+
$providers = array_keys(config('auth.providers'));
89+
90+
$provider = $this->option('provider') ?: $this->choice(
91+
'Which user provider should this client use to retrieve users?',
92+
$providers,
93+
in_array('users', $providers) ? 'users' : null
94+
);
9195

9296
$client = $clients->createPasswordGrantClient(
9397
null, $name, 'http://localhost', $provider
@@ -150,22 +154,6 @@ protected function createAuthCodeClient(ClientRepository $clients)
150154
$this->outputClientDetails($client);
151155
}
152156

153-
/**
154-
* Ask the user what user provider should be used.
155-
*
156-
* @return string
157-
*/
158-
protected function promptForProvider()
159-
{
160-
$providers = array_keys(config('auth.providers'));
161-
162-
return $this->option('provider') ?: $this->choice(
163-
'Which user provider should this client use to retrieve users?',
164-
$providers,
165-
in_array('users', $providers) ? 'users' : null
166-
);
167-
}
168-
169157
/**
170158
* Output the client's ID and secret key.
171159
*

src/Console/InstallCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function handle()
3939
$this->configureUuids();
4040
}
4141

42-
$this->call('passport:client', ['--personal' => true, '--name' => config('app.name').' Personal Access Client', '--provider' => $provider]);
42+
$this->call('passport:client', ['--personal' => true, '--name' => config('app.name').' Personal Access Client']);
4343
$this->call('passport:client', ['--password' => true, '--name' => config('app.name').' Password Grant Client', '--provider' => $provider]);
4444
}
4545

0 commit comments

Comments
 (0)