Skip to content

Commit 09e1315

Browse files
stefanak-michaltransistive
authored andcommitted
method has to return hello response, not logon.
1 parent f70d71c commit 09e1315

File tree

4 files changed

+32
-20
lines changed

4 files changed

+32
-20
lines changed

src/Authentication/BasicAuth.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,30 +57,30 @@ public function authenticateHttp(RequestInterface $request, UriInterface $uri, s
5757
}
5858

5959
/**
60+
* @return array{server: string, connection_id: string, hints: array}
6061
* @throws Exception
6162
*/
6263
public function authenticateBolt(V4_4|V5|V5_1|V5_2|V5_3|V5_4 $protocol, string $userAgent): array
6364
{
6465
if (method_exists($protocol, 'logon')) {
6566
$protocol->hello(['user_agent' => $userAgent]);
66-
ResponseHelper::getResponse($protocol);
67-
67+
$response = ResponseHelper::getResponse($protocol);
6868
$protocol->logon([
6969
'scheme' => 'basic',
7070
'principal' => $this->username,
7171
'credentials' => $this->password,
7272
]);
73+
ResponseHelper::getResponse($protocol);
74+
return $response->content;
7375
} else {
7476
$protocol->hello([
7577
'user_agent' => $userAgent,
7678
'scheme' => 'basic',
7779
'principal' => $this->username,
7880
'credentials' => $this->password,
7981
]);
82+
return ResponseHelper::getResponse($protocol)->content;
8083
}
81-
82-
/** @var array{server: string, connection_id: string, hints: list} */
83-
return ResponseHelper::getResponse($protocol)->content;
8484
}
8585

8686
public function toString(UriInterface $uri): string

src/Authentication/KerberosAuth.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Laudis\Neo4j\Contracts\AuthenticateInterface;
2424
use Psr\Http\Message\RequestInterface;
2525
use Psr\Http\Message\UriInterface;
26+
use Exception;
2627

2728
use function sprintf;
2829

@@ -52,28 +53,31 @@ public function authenticateHttp(RequestInterface $request, UriInterface $uri, s
5253
->withHeader('User-Agent', $userAgent);
5354
}
5455

56+
/**
57+
* @return array{server: string, connection_id: string, hints: array}
58+
* @throws Exception
59+
*/
5560
public function authenticateBolt(V4_4|V5|V5_1|V5_2|V5_3|V5_4 $protocol, string $userAgent): array
5661
{
5762
if (method_exists($protocol, 'logon')) {
5863
$protocol->hello(['user_agent' => $userAgent]);
59-
ResponseHelper::getResponse($protocol);
60-
64+
$response = ResponseHelper::getResponse($protocol);
6165
$protocol->logon([
6266
'scheme' => 'kerberos',
6367
'principal' => '',
6468
'credentials' => $this->token,
6569
]);
70+
ResponseHelper::getResponse($protocol);
71+
return $response->content;
6672
} else {
6773
$protocol->hello([
6874
'user_agent' => $userAgent,
6975
'scheme' => 'kerberos',
7076
'principal' => '',
7177
'credentials' => $this->token,
7278
]);
79+
return ResponseHelper::getResponse($protocol)->content;
7380
}
74-
75-
/** @var array{server: string, connection_id: string, hints: list} */
76-
return ResponseHelper::getResponse($protocol);
7781
}
7882

7983
public function toString(UriInterface $uri): string

src/Authentication/NoAuth.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Laudis\Neo4j\Contracts\AuthenticateInterface;
2424
use Psr\Http\Message\RequestInterface;
2525
use Psr\Http\Message\UriInterface;
26+
use Exception;
2627

2728
use function sprintf;
2829

@@ -44,24 +45,27 @@ public function authenticateHttp(RequestInterface $request, UriInterface $uri, s
4445
return $request->withHeader('User-Agent', $userAgent);
4546
}
4647

48+
/**
49+
* @return array{server: string, connection_id: string, hints: array}
50+
* @throws Exception
51+
*/
4752
public function authenticateBolt(V4_4|V5|V5_1|V5_2|V5_3|V5_4 $protocol, string $userAgent): array
4853
{
4954
if (method_exists($protocol, 'logon')) {
5055
$protocol->hello(['user_agent' => $userAgent]);
51-
ResponseHelper::getResponse($protocol);
52-
56+
$response = ResponseHelper::getResponse($protocol);
5357
$protocol->logon([
5458
'scheme' => 'none',
5559
]);
60+
ResponseHelper::getResponse($protocol);
61+
return $response->content;
5662
} else {
5763
$protocol->hello([
5864
'user_agent' => $userAgent,
5965
'scheme' => 'none',
6066
]);
67+
return ResponseHelper::getResponse($protocol)->content;
6168
}
62-
63-
/** @var array{server: string, connection_id: string, hints: list} */
64-
return ResponseHelper::getResponse($protocol)->content;
6569
}
6670

6771
public function toString(UriInterface $uri): string

src/Authentication/OpenIDConnectAuth.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Laudis\Neo4j\Contracts\AuthenticateInterface;
2424
use Psr\Http\Message\RequestInterface;
2525
use Psr\Http\Message\UriInterface;
26+
use Exception;
2627

2728
use function sprintf;
2829

@@ -49,26 +50,29 @@ public function authenticateHttp(RequestInterface $request, UriInterface $uri, s
4950
->withHeader('User-Agent', $userAgent);
5051
}
5152

53+
/**
54+
* @return array{server: string, connection_id: string, hints: array}
55+
* @throws Exception
56+
*/
5257
public function authenticateBolt(V4_4|V5|V5_1|V5_2|V5_3|V5_4 $protocol, string $userAgent): array
5358
{
5459
if (method_exists($protocol, 'logon')) {
5560
$protocol->hello(['user_agent' => $userAgent]);
56-
ResponseHelper::getResponse($protocol);
57-
61+
$response = ResponseHelper::getResponse($protocol);
5862
$protocol->logon([
5963
'scheme' => 'bearer',
6064
'credentials' => $this->token,
6165
]);
66+
ResponseHelper::getResponse($protocol);
67+
return $response->content;
6268
} else {
6369
$protocol->hello([
6470
'user_agent' => $userAgent,
6571
'scheme' => 'bearer',
6672
'credentials' => $this->token,
6773
]);
74+
return ResponseHelper::getResponse($protocol)->content;
6875
}
69-
70-
/** @var array{server: string, connection_id: string, hints: list} */
71-
return ResponseHelper::getResponse($protocol)->content;
7276
}
7377

7478
public function toString(UriInterface $uri): string

0 commit comments

Comments
 (0)