Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
evansims committed Jun 4, 2024
2 parents 57b4aeb + b4d099a commit 6647ec0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
21 changes: 18 additions & 3 deletions src/Guards/AuthenticationGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 6647ec0

Please sign in to comment.