Skip to content

Commit

Permalink
Revert "Adding basic authentication by default on signed routes (#684)"
Browse files Browse the repository at this point in the history
This reverts commit 05af22c.
  • Loading branch information
driesvints authored Feb 16, 2024
1 parent d189561 commit 543b1cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/Two/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,7 @@ public function getAccessTokenResponse($code)
*/
protected function getTokenHeaders($code)
{
return [
'Accept' => 'application/json',
'Authorization' => 'Basic '.base64_encode($this->clientId.':'.$this->clientSecret),
];
return ['Accept' => 'application/json'];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/OAuthTwoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testTokenRequestIncludesPKCECodeVerifier()
$provider = new OAuthTwoWithPKCETestProviderStub($request, 'client_id', 'client_secret', 'redirect_uri');
$provider->http = m::mock(stdClass::class);
$provider->http->expects('post')->with('http://token.url', [
'headers' => ['Accept' => 'application/json', 'Authorization' => 'Basic '.base64_encode('client_id:client_secret')], 'form_params' => ['grant_type' => 'authorization_code', 'client_id' => 'client_id', 'client_secret' => 'client_secret', 'code' => 'code', 'redirect_uri' => 'redirect_uri', 'code_verifier' => $codeVerifier],
'headers' => ['Accept' => 'application/json'], 'form_params' => ['grant_type' => 'authorization_code', 'client_id' => 'client_id', 'client_secret' => 'client_secret', 'code' => 'code', 'redirect_uri' => 'redirect_uri', 'code_verifier' => $codeVerifier],
])->andReturns($response = m::mock(stdClass::class));
$response->expects('getBody')->andReturns('{ "access_token" : "access_token", "refresh_token" : "refresh_token", "expires_in" : 3600 }');
$user = $provider->user();
Expand All @@ -124,7 +124,7 @@ public function testUserReturnsAUserInstanceForTheAuthenticatedRequest()
$provider = new OAuthTwoTestProviderStub($request, 'client_id', 'client_secret', 'redirect_uri');
$provider->http = m::mock(stdClass::class);
$provider->http->expects('post')->with('http://token.url', [
'headers' => ['Accept' => 'application/json', 'Authorization' => 'Basic '.base64_encode('client_id:client_secret')], 'form_params' => ['grant_type' => 'authorization_code', 'client_id' => 'client_id', 'client_secret' => 'client_secret', 'code' => 'code', 'redirect_uri' => 'redirect_uri'],
'headers' => ['Accept' => 'application/json'], 'form_params' => ['grant_type' => 'authorization_code', 'client_id' => 'client_id', 'client_secret' => 'client_secret', 'code' => 'code', 'redirect_uri' => 'redirect_uri'],
])->andReturns($response = m::mock(stdClass::class));
$response->expects('getBody')->andReturns('{ "access_token" : "access_token", "refresh_token" : "refresh_token", "expires_in" : 3600 }');
$user = $provider->user();
Expand Down

0 comments on commit 543b1cc

Please sign in to comment.