Skip to content

Commit

Permalink
added IdentityRestorer
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 3, 2021
1 parent 8a38f25 commit c6165c5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Security/IdentityRestorer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* This file is part of the Nette Framework (https://nette.org)
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
*/

declare(strict_types=1);

namespace Nette\Security;


/**
* Restores Identity from storage.
*/
interface IdentityRestorer
{
/**
* Refreshes stored identity.
*/
function restoreIdentity(IIdentity $identity): IIdentity;
}
3 changes: 3 additions & 0 deletions src/Security/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ private function getStoredData(): void
$this->identity = $this->storage->getIdentity();
$this->logoutReason = $this->storage->getLogoutReason();
}
if ($this->authenticator instanceof IdentityRestorer) {
$this->identity = $this->authenticator->restoreIdentity($this->identity);
}
}


Expand Down

0 comments on commit c6165c5

Please sign in to comment.