1: <?php
2:
3: /*
4: * This file is part of the Symfony package.
5: *
6: * (c) Fabien Potencier <fabien@symfony.com>
7: *
8: * For the full copyright and license information, please view the LICENSE
9: * file that was distributed with this source code.
10: */
11:
12: namespace Symfony\Component\Security\Core\User;
13:
14: use Symfony\Component\Security\Core\Exception\AccountStatusException;
15: use Symfony\Component\Security\Core\Exception\AccountExpiredException;
16: use Symfony\Component\Security\Core\Exception\LockedException;
17: use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
18: use Symfony\Component\Security\Core\Exception\DisabledException;
19:
20: /**
21: * Adds extra features to a user class related to account status flags.
22: *
23: * This interface can be implemented in place of UserInterface if you'd like
24: * the authentication system to consider different account status flags
25: * during authentication. If any of the methods in this interface return
26: * false, authentication will fail.
27: *
28: * If you need to perform custom logic for any of these situations, then
29: * you will need to register an exception listener and watch for the specific
30: * exception instances thrown in each case. All exceptions are a subclass
31: * of AccountStatusException
32: *
33: * @see UserInterface
34: * @see AccountStatusException
35: *
36: * @author Fabien Potencier <fabien@symfony.com>
37: */
38: interface AdvancedUserInterface extends UserInterface
39: {
40: /**
41: * Checks whether the user's account has expired.
42: *
43: * Internally, if this method returns false, the authentication system
44: * will throw an AccountExpiredException and prevent login.
45: *
46: * @return bool true if the user's account is non expired, false otherwise
47: *
48: * @see AccountExpiredException
49: */
50: public function isAccountNonExpired();
51:
52: /**
53: * Checks whether the user is locked.
54: *
55: * Internally, if this method returns false, the authentication system
56: * will throw a LockedException and prevent login.
57: *
58: * @return bool true if the user is not locked, false otherwise
59: *
60: * @see LockedException
61: */
62: public function isAccountNonLocked();
63:
64: /**
65: * Checks whether the user's credentials (password) has expired.
66: *
67: * Internally, if this method returns false, the authentication system
68: * will throw a CredentialsExpiredException and prevent login.
69: *
70: * @return bool true if the user's credentials are non expired, false otherwise
71: *
72: * @see CredentialsExpiredException
73: */
74: public function isCredentialsNonExpired();
75:
76: /**
77: * Checks whether the user is enabled.
78: *
79: * Internally, if this method returns false, the authentication system
80: * will throw a DisabledException and prevent login.
81: *
82: * @return bool true if the user is enabled, false otherwise
83: *
84: * @see DisabledException
85: */
86: public function isEnabled();
87: }
88: