diff --git a/CHANGELOG.md b/CHANGELOG.md index 24cf229..f3c6cda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ -# Changelog +# Change Log + +## [7.14.0](https://github.com/auth0/laravel-auth0/tree/7.14.0) (2024-04-01) +[Full Changelog](https://github.com/auth0/laravel-auth0/compare/7.13.0...7.14.0) + +**Changed** +- refactor: add additional Telescope state check [\#447](https://github.com/auth0/laravel-auth0/pull/447) ([samuelhgf](https://github.com/samuelhgf)) +- chore(deps): replace temporary `psalm-laravel-plugin` fork with official [\#448](https://github.com/auth0/laravel-auth0/pull/448) ([alies-dev](https://github.com/alies-dev)) ## [7.15.0](https://github.com/auth0/laravel-auth0/tree/7.15.0) (2024-06-03) diff --git a/src/Guards/AuthenticationGuard.php b/src/Guards/AuthenticationGuard.php index 23f8c7a..e3cc4ff 100644 --- a/src/Guards/AuthenticationGuard.php +++ b/src/Guards/AuthenticationGuard.php @@ -32,6 +32,8 @@ final class AuthenticationGuard extends GuardAbstract implements AuthenticationG */ protected const TELESCOPE = '\Laravel\Telescope\Telescope'; + private ?string $credThumbprint = null; + public function find(): ?CredentialEntityContract { if ($this->isImpersonating()) { @@ -93,9 +95,13 @@ public function getCredential(): ?CredentialEntityContract } if ($this->credential instanceof CredentialEntityContract) { - $updated = $this->findSession(); - $this->setCredential($updated); - $this->pushState($updated); + $currThumbprint = $this->getCredThumbprint($this->sdk()->getCredentials()); + if ($currThumbprint !== $this->credThumbprint) { + $updated = $this->findSession(); + $this->setCredential($updated); + $this->pushState($updated); + $this->credThumbprint = $currThumbprint; + } } return $this->credential; @@ -331,6 +337,15 @@ public function user(): ?Authenticatable return $lastResponse = null; } + private function getCredThumbprint(?object $credential): null | string + { + if (null === $credential) { + return null; + } + + return md5(serialize($credential)); + } + private function pullState(): ?CredentialEntityContract { $sdk = $this->sdk();