-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathIdentityHandler.php
More file actions
30 lines (24 loc) · 806 Bytes
/
IdentityHandler.php
File metadata and controls
30 lines (24 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php declare(strict_types=1);
/**
* This file is part of the Nette Framework (https://nette.org)
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
*/
namespace Nette\Security;
/**
* Serializes and restores identity to/from persistent storage.
*/
interface IdentityHandler
{
/**
* Called before identity is written to storage. Typically replaces the full identity with a lightweight token.
*/
function sleepIdentity(IIdentity $identity): IIdentity;
/**
* Called after identity is read from storage. Typically refreshes roles or validates the token. Returns null to force logout.
*/
function wakeupIdentity(IIdentity $identity): ?IIdentity;
/**
* Returns the identity for an anonymous (not logged-in) user, or null if none.
*/
function getGuestIdentity(): ?IIdentity;
}