1 | <?php |
||
20 | class EnhancedAuthenticate extends Authenticate |
||
21 | { |
||
22 | use ClassOptionsTrait; |
||
23 | |||
24 | /** |
||
25 | * @var array An associative array containing options |
||
26 | */ |
||
27 | protected $options = []; |
||
28 | |||
29 | /** |
||
30 | * Class Constructor |
||
31 | * |
||
32 | * @param Session $session |
||
33 | * @param Password $password |
||
34 | * @param array $options |
||
35 | */ |
||
36 | public function __construct(Session $session, Password $password, array $options = []) |
||
43 | |||
44 | /** |
||
45 | * Try to attempt login with the informations passed by param. |
||
46 | * |
||
47 | * @param string $userName |
||
48 | * @param string $password |
||
49 | * @param string $storedUserName |
||
50 | * @param string $storedPassword |
||
51 | * @param int $storedId |
||
52 | * |
||
53 | * @return boolean |
||
54 | */ |
||
55 | public function login(string $userName, string $password, string $storedUserName = '', string $storedPassword = '', int $storedId = 0) |
||
61 | |||
62 | /** |
||
63 | * Check if an account is locked after too much failed. |
||
64 | * |
||
65 | * @param string $userName |
||
66 | * |
||
67 | * @return bool |
||
68 | */ |
||
69 | public function IsAccountLocked(string $userName) : bool |
||
73 | |||
74 | /** |
||
75 | * Return how many attemps are left for incorrect password. |
||
76 | * |
||
77 | * @param string $userName |
||
78 | * |
||
79 | * @return int |
||
80 | */ |
||
81 | public function getAttemptsLeftWithSameUser(string $userName) : int |
||
85 | |||
86 | /** |
||
87 | * Return how many attemps are left for same ip. |
||
88 | * |
||
89 | * @param string $ip |
||
90 | * |
||
91 | * @return int |
||
92 | */ |
||
93 | public function getAttemptsLeftWithSameIp(string $ip) : int |
||
97 | |||
98 | /** |
||
99 | * Return how many attemps are left for same session id. |
||
100 | * |
||
101 | * @param string $sessionId |
||
102 | * |
||
103 | * @return int |
||
104 | */ |
||
105 | public function getAttemptsLeftWithSameSession(string $sessionId) : int |
||
109 | |||
110 | /** |
||
111 | * Check if an user is banned from do login. |
||
112 | * |
||
113 | * @param string $userName |
||
114 | * |
||
115 | * @return bool |
||
116 | */ |
||
117 | public function isUserBanned(string $userName) : bool |
||
121 | |||
122 | /** |
||
123 | * Check if an ip address is banned from do login. |
||
124 | * |
||
125 | * @param string $ip |
||
126 | * |
||
127 | * @return bool |
||
128 | */ |
||
129 | public function isIpBanned(string $ip) : bool |
||
133 | |||
134 | /** |
||
135 | * Check if a session id is banned from do login. |
||
136 | * |
||
137 | * @param string $sessionId |
||
138 | * |
||
139 | * @return bool |
||
140 | */ |
||
141 | public function isSessionBanned(string $sessionId) : bool |
||
145 | } |
||
146 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.