Skip to content
Merged
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
25 changes: 13 additions & 12 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ final public function respondToAuthorizationRequest(

// Return the HTTP redirect response
$response = $authorizationServer->completeAuthorizationRequest($authRequest, $response);
$this->addIssuerToResponse($response); // add &iss=... to the response to comply with RFC 9207
$response = $this->addIssuerToResponse($response); // add &iss=... to the response to comply with RFC 9207
} else {
// @CHECKME: 404 or throw Exception?
$response = $response->withStatus(404);
Expand All @@ -117,20 +117,21 @@ final public function respondToAuthorizationRequest(

public function addIssuerToResponse($response): Response
{
// Adds &iss=... to the response to comply with RFC 9207
$location = $response->getHeaderLine('Location');
$uri = new Uri($location);
// Adds &iss=... to the response to comply with RFC 9207
if ($response->hasHeader("Location")) {
$location = $response->getHeaderLine('Location');
$uri = new Uri($location);

parse_str($uri->getQuery(), $params);
$params['iss'] = $this->config->getServer()->get(OidcMeta::ISSUER);
parse_str($uri->getQuery(), $params);
$params['iss'] = $this->config->getServer()->get(OidcMeta::ISSUER);

$uri = $uri->withQuery(http_build_query($params));

$response = $response->withHeader(
'Location',
(string) $uri
);
$uri = $uri->withQuery(http_build_query($params));

$response = $response->withHeader(
'Location',
(string) $uri
);
}
return $response;
}

Expand Down
Loading