Started implementing token exchange, tests
This commit is contained in:
parent
c3b4e5ec5b
commit
9c6ef316e1
@ -537,6 +537,10 @@ EOT
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach ($testCases as $name => $params) {
|
foreach ($testCases as $name => $params) {
|
||||||
|
foreach ([
|
||||||
|
[$s, 'handleAuthorizationEndpointRequest'],
|
||||||
|
[$s, 'handleTokenEndpointRequest'],
|
||||||
|
] as $endpointHandler) {
|
||||||
// Create an auth code.
|
// Create an auth code.
|
||||||
$codeVerifier = generateRandomString(32);
|
$codeVerifier = generateRandomString(32);
|
||||||
$authCode = $storage->createAuthCode([
|
$authCode = $storage->createAuthCode([
|
||||||
@ -555,15 +559,11 @@ EOT
|
|||||||
'code_verifier' => $codeVerifier
|
'code_verifier' => $codeVerifier
|
||||||
], $params));
|
], $params));
|
||||||
|
|
||||||
$authEndpointResponse = $s->handleAuthorizationEndpointRequest($req);
|
$res = $endpointHandler($req);
|
||||||
$this->assertEquals(400, $authEndpointResponse->getStatusCode());
|
$this->assertEquals(400, $res->getStatusCode());
|
||||||
$authEndpointJson = json_decode((string) $authEndpointResponse->getBody(), true);
|
$resJson = json_decode((string) $res->getBody(), true);
|
||||||
$this->assertEquals('invalid_grant', $authEndpointJson['error']);
|
$this->assertEquals('invalid_grant', $resJson['error']);
|
||||||
|
}
|
||||||
$tokenEndpointResponse = $s->handleTokenEndpointRequest($req);
|
|
||||||
$this->assertEquals(400, $tokenEndpointResponse->getStatusCode());
|
|
||||||
$tokenEndpointJson = json_decode((string) $tokenEndpointResponse->getBody(), true);
|
|
||||||
$this->assertEquals('invalid_grant', $tokenEndpointJson['error']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user