Skip to content

Commit 3dc60ed

Browse files
committed
added IdentityRestorer
1 parent 3184a5d commit 3dc60ed

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/Security/IdentityRestorer.php

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the Nette Framework (https://nette.org)
5+
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace Nette\Security;
11+
12+
13+
/**
14+
* Restores Identity from storage.
15+
*/
16+
interface IdentityRestorer
17+
{
18+
/**
19+
* Refreshes stored identity.
20+
*/
21+
function restoreIdentity(IIdentity $identity): IIdentity;
22+
}

src/Security/User.php

+3
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ private function getStoredData(): void
178178
$this->identity = $this->storage->getIdentity();
179179
$this->logoutReason = $this->storage->getLogoutReason();
180180
}
181+
if ($this->authenticator instanceof IdentityRestorer) {
182+
$this->identity = $this->authenticator->restoreIdentity($this->identity);
183+
}
181184
}
182185

183186

0 commit comments

Comments
 (0)