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