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: namespace Nette\Security;
9:
10: use Nette;
11:
12:
13: /**
14: * Interface for persistent storage for user object data.
15: *
16: * @author David Grudl, Jan Tichý
17: */
18: interface IUserStorage
19: {
20: /** Log-out reason {@link IUserStorage::getLogoutReason()} */
21: const MANUAL = 1,
22: INACTIVITY = 2,
23: BROWSER_CLOSED = 4;
24:
25: /** Log-out behavior */
26: const CLEAR_IDENTITY = 8;
27:
28: /**
29: * Sets the authenticated status of this user.
30: * @param bool
31: * @return void
32: */
33: function setAuthenticated($state);
34:
35: /**
36: * Is this user authenticated?
37: * @return bool
38: */
39: function isAuthenticated();
40:
41: /**
42: * Sets the user identity.
43: * @return void
44: */
45: function setIdentity(IIdentity $identity = NULL);
46:
47: /**
48: * Returns current user identity, if any.
49: * @return Nette\Security\IIdentity|NULL
50: */
51: function getIdentity();
52:
53: /**
54: * Enables log out from the persistent storage after inactivity.
55: * @param string|int|DateTime number of seconds or timestamp
56: * @param int Log out when the browser is closed | Clear the identity from persistent storage?
57: * @return void
58: */
59: function setExpiration($time, $flags = 0);
60:
61: /**
62: * Why was user logged out?
63: * @return int
64: */
65: function getLogoutReason();
66:
67: }
68: