Skip to content

Commit 97dbc97

Browse files
authored
Merge pull request thephpleague#1233 from Sephster/fix-type-check-errors
Removes Check Forcing Client ID to be a String
2 parents 4ea27e8 + 1423ae4 commit 97dbc97

File tree

4 files changed

+8
-35
lines changed

4 files changed

+8
-35
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
## [8.3.1] - released 2021-06-04
10+
### Fixed
11+
- Revert check on clientID. We will no longer require this to be a string (PR #1233)
12+
913
## [8.3.0] - released 2021-06-03
1014
### Added
1115
- The server will now validate redirect uris according to rfc8252 (PR #1203)
@@ -541,7 +545,8 @@ Version 5 is a complete code rewrite.
541545

542546
- First major release
543547

544-
[Unreleased]: https://github.com/thephpleague/oauth2-server/compare/8.3.0...HEAD
548+
[Unreleased]: https://github.com/thephpleague/oauth2-server/compare/8.3.1...HEAD
549+
[8.3.1]: https://github.com/thephpleague/oauth2-server/compare/8.3.0...8.3.1
545550
[8.3.0]: https://github.com/thephpleague/oauth2-server/compare/8.2.4...8.3.0
546551
[8.2.4]: https://github.com/thephpleague/oauth2-server/compare/8.2.3...8.2.4
547552
[8.2.3]: https://github.com/thephpleague/oauth2-server/compare/8.2.2...8.2.3

src/Grant/AbstractGrant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ protected function getClientCredentials(ServerRequestInterface $request)
256256

257257
$clientId = $this->getRequestParameter('client_id', $request, $basicAuthUser);
258258

259-
if (!\is_string($clientId)) {
259+
if (\is_null($clientId)) {
260260
throw OAuthServerException::invalidRequest('client_id');
261261
}
262262

src/Grant/ImplicitGrant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function validateAuthorizationRequest(ServerRequestInterface $request)
120120
$this->getServerParameter('PHP_AUTH_USER', $request)
121121
);
122122

123-
if (!\is_string($clientId)) {
123+
if (\is_null($clientId)) {
124124
throw OAuthServerException::invalidRequest('client_id');
125125
}
126126

tests/Grant/AbstractGrantTest.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,6 @@ public function testHttpBasicNoColon()
8989
$this->assertSame([null, null], $basicAuthMethod->invoke($grantMock, $serverRequest));
9090
}
9191

92-
public function testGetClientCredentialsClientIdNotAString()
93-
{
94-
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
95-
96-
/** @var AbstractGrant $grantMock */
97-
$grantMock = $this->getMockForAbstractClass(AbstractGrant::class);
98-
$grantMock->setClientRepository($clientRepositoryMock);
99-
100-
$abstractGrantReflection = new \ReflectionClass($grantMock);
101-
102-
$serverRequest = new ServerRequest(
103-
[],
104-
[],
105-
null,
106-
'POST',
107-
'php://input',
108-
[],
109-
[],
110-
[],
111-
[
112-
'client_id' => ['not', 'a', 'string'],
113-
'client_secret' => 'client_secret',
114-
]
115-
);
116-
$getClientCredentialsMethod = $abstractGrantReflection->getMethod('getClientCredentials');
117-
$getClientCredentialsMethod->setAccessible(true);
118-
119-
$this->expectException(\League\OAuth2\Server\Exception\OAuthServerException::class);
120-
121-
$getClientCredentialsMethod->invoke($grantMock, $serverRequest, true, true);
122-
}
123-
12492
public function testGetClientCredentialsClientSecretNotAString()
12593
{
12694
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();

0 commit comments

Comments
 (0)