Skip to content

Commit

Permalink
be conservative since IamSignerTrait is not internal
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Feb 13, 2024
1 parent 6cbd0d8 commit c73340e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/IamSignerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ trait IamSignerTrait
/**
* @var Iam|null
*/
private ?Iam $iam;
private $iam;

/**
* Sign a string using the default service account private key.
Expand All @@ -51,8 +51,9 @@ public function signBlob($stringToSign, $forceOpenSsl = false, $accessToken = nu

// Providing a signer is useful for testing, but it's undocumented
// because it's not something a user would generally need to do.
if (!isset($this->iam)) {
$this->iam = $this instanceof GetUniverseDomainInterface
$signer = $this->iam;
if (!$signer) {
$signer = $this instanceof GetUniverseDomainInterface
? new Iam($httpHandler, $this->getUniverseDomain())
: new Iam($httpHandler);
}
Expand All @@ -66,6 +67,6 @@ public function signBlob($stringToSign, $forceOpenSsl = false, $accessToken = nu
: $this->fetchAuthToken($httpHandler)['access_token'];
}

return $this->iam->signBlob($email, $accessToken, $stringToSign);
return $signer->signBlob($email, $accessToken, $stringToSign);
}
}

0 comments on commit c73340e

Please sign in to comment.