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