mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
Add test to ensure public clients are asked to provide a code challenge
This commit is contained in:
parent
0105a20126
commit
8ab27ede39
@ -148,6 +148,7 @@ class AuthorizationServerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$client = new ClientEntity();
|
$client = new ClientEntity();
|
||||||
$client->setRedirectUri('http://foo/bar');
|
$client->setRedirectUri('http://foo/bar');
|
||||||
|
$client->setIsConfidential();
|
||||||
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
|
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
|
||||||
$clientRepositoryMock->method('getClientEntity')->willReturn($client);
|
$clientRepositoryMock->method('getClientEntity')->willReturn($client);
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
{
|
{
|
||||||
$client = new ClientEntity();
|
$client = new ClientEntity();
|
||||||
$client->setRedirectUri('http://foo/bar');
|
$client->setRedirectUri('http://foo/bar');
|
||||||
|
$client->setIsConfidential();
|
||||||
|
|
||||||
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
|
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
|
||||||
$clientRepositoryMock->method('getClientEntity')->willReturn($client);
|
$clientRepositoryMock->method('getClientEntity')->willReturn($client);
|
||||||
@ -123,6 +124,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
{
|
{
|
||||||
$client = new ClientEntity();
|
$client = new ClientEntity();
|
||||||
$client->setRedirectUri(['http://foo/bar']);
|
$client->setRedirectUri(['http://foo/bar']);
|
||||||
|
$client->setIsConfidential();
|
||||||
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
|
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
|
||||||
$clientRepositoryMock->method('getClientEntity')->willReturn($client);
|
$clientRepositoryMock->method('getClientEntity')->willReturn($client);
|
||||||
|
|
||||||
@ -198,6 +200,7 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* $this->expectException(OAuth
|
||||||
* @expectedException \League\OAuth2\Server\Exception\OAuthServerException
|
* @expectedException \League\OAuth2\Server\Exception\OAuthServerException
|
||||||
*/
|
*/
|
||||||
public function testValidateAuthorizationRequestCodeChallengeInvalidLengthTooShort()
|
public function testValidateAuthorizationRequestCodeChallengeInvalidLengthTooShort()
|
||||||
@ -1818,6 +1821,9 @@ class AuthCodeGrantTest extends TestCase
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(AuthorizationRequest::class, $grant->validateAuthorizationRequest($request));
|
$this->expectException(OAuthServerException::class);
|
||||||
|
$this->expectExceptionCode(3);
|
||||||
|
|
||||||
|
$grant->validateAuthorizationRequest($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user