Renamed server respondToRequest to respondToAccessTokenRequest

This commit is contained in:
Alex Bilbie 2016-04-09 16:20:30 +01:00
parent 6ee71754c4
commit 4689802c30
5 changed files with 7 additions and 7 deletions

View File

@ -50,7 +50,7 @@ $app->post('/access_token', function (ServerRequestInterface $request, ResponseI
$server = $app->getContainer()->get(Server::class);
try {
return $server->respondToRequest($request, $response);
return $server->respondToAccessTokenRequest($request, $response);
} catch (OAuthServerException $exception) {
return $exception->generateHttpResponse($response);
} catch (\Exception $exception) {

View File

@ -54,7 +54,7 @@ $app->post('/access_token', function (ServerRequestInterface $request, ResponseI
$server = $app->getContainer()->get(Server::class);
try {
return $server->respondToRequest($request, $response);
return $server->respondToAccessTokenRequest($request, $response);
} catch (OAuthServerException $exception) {
return $exception->generateHttpResponse($response);
} catch (\Exception $exception) {

View File

@ -52,7 +52,7 @@ $app->post('/access_token', function (ServerRequestInterface $request, ResponseI
$server = $app->getContainer()->get(Server::class);
try {
return $server->respondToRequest($request, $response);
return $server->respondToAccessTokenRequest($request, $response);
} catch (OAuthServerException $exception) {
return $exception->generateHttpResponse($response);
} catch (\Exception $exception) {

View File

@ -134,7 +134,7 @@ class Server implements EmitterAwareInterface
*
* @return \Psr\Http\Message\ResponseInterface
*/
public function respondToRequest(ServerRequestInterface $request, ResponseInterface $response)
public function respondToAccessTokenRequest(ServerRequestInterface $request, ResponseInterface $response)
{
$tokenResponse = null;
while ($tokenResponse === null && $grantType = array_shift($this->enabledGrantTypes)) {

View File

@ -38,7 +38,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase
$server->enableGrantType(new ClientCredentialsGrant(), new \DateInterval('PT1M'));
try {
$server->respondToRequest(ServerRequestFactory::fromGlobals(), new Response);
$server->respondToAccessTokenRequest(ServerRequestFactory::fromGlobals(), new Response);
} catch (OAuthServerException $e) {
$this->assertEquals('unsupported_grant_type', $e->getErrorType());
$this->assertEquals(400, $e->getHttpStatusCode());
@ -70,7 +70,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase
$_POST['grant_type'] = 'client_credentials';
$_POST['client_id'] = 'foo';
$_POST['client_secret'] = 'bar';
$response = $server->respondToRequest(ServerRequestFactory::fromGlobals(), new Response);
$response = $server->respondToAccessTokenRequest(ServerRequestFactory::fromGlobals(), new Response);
$this->assertEquals(200, $response->getStatusCode());
}
@ -119,7 +119,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase
$_POST['action'] = 'approve';
$_POST['username'] = 'user';
$_POST['password'] = 'pass';
$response = $server->respondToRequest(ServerRequestFactory::fromGlobals(), new Response);
$response = $server->respondToAccessTokenRequest(ServerRequestFactory::fromGlobals(), new Response);
$this->assertTrue($response instanceof ResponseInterface);
$this->assertEquals(302, $response->getStatusCode());
$this->assertTrue(strstr($response->getHeaderLine('location'), 'code=') !== false);