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