Skip to content

Commit

Permalink
Merge pull request #24 from alecpl/dev/issuer-fix
Browse files Browse the repository at this point in the history
Use the same issuer in token and discovery responses
  • Loading branch information
jeremy379 authored Dec 12, 2024
2 parents 67877fe + 869ca84 commit 145fe4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 1 addition & 8 deletions src/IdTokenResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,10 @@ protected function getBuilder(
($this->useMicroseconds ? microtime(true) : time())
);

if ($this->currentRequestService) {
$uri = $this->currentRequestService->getRequest()->getUri();
$issuer = $uri->getScheme() . '://' . $uri->getHost() . ($uri->getPort() ? ':' . $uri->getPort() : '');
} else {
$issuer = 'https://' . $_SERVER['HTTP_HOST'];
}

return $this->config
->builder()
->permittedFor($accessToken->getClient()->getIdentifier())
->issuedBy($issuer)
->issuedBy('https://' . $_SERVER['HTTP_HOST'])
->issuedAt($dateTimeImmutableObject)
->expiresAt($dateTimeImmutableObject->add(new DateInterval('PT1H')))
->relatedTo($userEntity->getIdentifier());
Expand Down
5 changes: 4 additions & 1 deletion src/Laravel/DiscoveryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\URL;
use Laravel\Passport\Passport;

class DiscoveryController
Expand All @@ -13,8 +14,10 @@ class DiscoveryController
*/
public function __invoke(Request $request)
{
URL::forceScheme('https'); // for route() calls below

$response = [
'issuer' => url('/'),
'issuer' => 'https://' . $_SERVER['HTTP_HOST'],
'authorization_endpoint' => route('passport.authorizations.authorize'),
'token_endpoint' => route('passport.token'),
'grant_types_supported' => $this->getSupportedGrantTypes(),
Expand Down

0 comments on commit 145fe4d

Please sign in to comment.