Skip to content

Commit 46f6dfd

Browse files
authored
Fix client_name rename in oauth registrar (#104)
* fix client_name removal in oauth registrar * typehint createAuthorizationCodeGrantClient so the test is more accurate
1 parent d75a6a1 commit 46f6dfd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Server/Http/Controllers/OAuthRegisterController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __invoke(Request $request): JsonResponse
3737
);
3838

3939
$client = $clients->createAuthorizationCodeGrantClient(
40-
name: $request->get('name'),
40+
name: $request->get('client_name', $request->get('name')),
4141
redirectUris: $validated['redirect_uris'],
4242
confidential: false,
4343
user: null,

tests/Unit/Server/RegistrarTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public static function tokensCan($scopes) {
166166
eval('
167167
namespace Laravel\Passport;
168168
class ClientRepository {
169-
public function createAuthorizationCodeGrantClient($name, $redirectUris, $confidential, $user, $enableDeviceFlow) {
169+
public function createAuthorizationCodeGrantClient(string $name, array $redirectUris, bool $confidential = true, $user = null, bool $enableDeviceFlow = false) {
170170
return (object) [
171171
"id" => "test-client-id",
172172
"grantTypes" => ["authorization_code"],
@@ -204,7 +204,7 @@ public function createAuthorizationCodeGrantClient($name, $redirectUris, $confid
204204
eval('
205205
namespace Laravel\Passport;
206206
class ClientRepository {
207-
public function createAuthorizationCodeGrantClient($name, $redirectUris, $confidential, $user, $enableDeviceFlow) {
207+
public function createAuthorizationCodeGrantClient(string $name, array $redirectUris, bool $confidential = true, $user = null, bool $enableDeviceFlow = false) {
208208
return (object) [
209209
"id" => "test-client-id",
210210
"grantTypes" => ["authorization_code"],
@@ -244,7 +244,7 @@ public function createAuthorizationCodeGrantClient($name, $redirectUris, $confid
244244
eval('
245245
namespace Laravel\Passport;
246246
class ClientRepository {
247-
public function createAuthorizationCodeGrantClient($name, $redirectUris, $confidential, $user, $enableDeviceFlow) {
247+
public function createAuthorizationCodeGrantClient(string $name, array $redirectUris, bool $confidential = true, $user = null, bool $enableDeviceFlow = false) {
248248
return (object) [
249249
"id" => "test-client-id",
250250
"grantTypes" => ["authorization_code"],

0 commit comments

Comments
 (0)