Skip to content

Commit

Permalink
Hotfix: urlencode credentials in clientSecret
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasvargiu committed Feb 2, 2021
1 parent 41dfc39 commit 4ccd1e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/AuthMethod/ClientSecretBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function createRequest(

$request = $request->withHeader(
'Authorization',
'Basic ' . base64_encode($clientId . ':' . $clientSecret)
'Basic ' . base64_encode(urlencode($clientId) . ':' . urlencode($clientSecret))
);

$request->getBody()->write(http_build_query($claims));
Expand Down
6 changes: 3 additions & 3 deletions tests/AuthMethod/ClientSecretBasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public function testCreateRequest(): void
$metadata = $this->prophesize(ClientMetadataInterface::class);

$client->getMetadata()->willReturn($metadata->reveal());
$metadata->getClientId()->willReturn('foo');
$metadata->getClientSecret()->willReturn('bar');
$metadata->getClientId()->willReturn('fooo');
$metadata->getClientSecret()->willReturn('bar%');

$request->withHeader('Authorization', 'Basic ' . base64_encode('foo:bar'))
$request->withHeader('Authorization', 'Basic ' . base64_encode('fooo:bar%25'))
->shouldBeCalled()
->willReturn($requestWithHeader->reveal());

Expand Down

0 comments on commit 4ccd1e6

Please sign in to comment.