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