Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions env-vars-testers.list
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ SERVER_ROOT_ESCAPED=https:\/\/server
SERVER_ROOT=https://server
STORAGE_ROOT=https://server/apps/solid/~alice/storage/
SKIP_CONC=1
DEBUG=*
12 changes: 6 additions & 6 deletions solid/lib/Controller/ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ private function createAuthServerConfig() {
if (isset($_GET['client_id'])) {
$clientId = $_GET['client_id'];
} else if (isset($_POST['client_id'])) {
if (isset($_POST['refresh_token'])) { // FIXME: Why does the test suite break without this?
$clientId = $_POST['client_id'];
}
$clientId = $_POST['client_id'];
}
$client = $this->getClient($clientId);
$keys = $this->getKeys();
Expand Down Expand Up @@ -323,17 +321,19 @@ public function session() {
*/
public function token() {
$request = \Laminas\Diactoros\ServerRequestFactory::fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
$grantType = $request->getParsedBody()['grant_type'];
$requestBody = $request->getParsedBody();
$grantType = isset($requestBody['grant_type']) ? $requestBody['grant_type'] : null;
$clientId = isset($requestBody['client_id']) ? $requestBody['client_id'] : null;
switch ($grantType) {
case "authorization_code":
$code = $request->getParsedBody()['code'];
$code = $requestBody['code'];
// FIXME: not sure if decoding this here is the way to go.
// FIXME: because this is a public page, the nonce from the session is not available here.
$codeInfo = $this->tokenGenerator->getCodeInfo($code);
$userId = $codeInfo['user_id'];
break;
case "refresh_token":
$refreshToken = $request->getParsedBody()['refresh_token'];
$refreshToken = $requestBody['refresh_token'];
$tokenInfo = $this->tokenGenerator->getCodeInfo($refreshToken); // FIXME: getCodeInfo should be named 'decrypt' or 'getInfo'?
$userId = $tokenInfo['user_id'];
break;
Expand Down
2 changes: 2 additions & 0 deletions solid/tests/Unit/Controller/ServerControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public function testRegisterWithRedirectUris()
'registration_client_uri' => '',
'response_types' => ['id_token token'],
'token_endpoint_auth_method' => 'client_secret_basic',
'client_secret' => '3b5798fddd49e23662ee6fe801085100',
],
'headers' => [
'Cache-Control' => 'no-cache, no-store, must-revalidate',
Expand All @@ -369,6 +370,7 @@ public function testToken()
{
$_POST['client_id'] = self::MOCK_CLIENT_ID;
$_POST['code'] = '';
$_POST['grant_type'] = 'authorization_code';
$_SERVER['HTTP_DPOP'] = 'mock dpop';
$_SESSION['nonce'] = 'mock nonce';

Expand Down
Loading