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