Vaskovsky Web Application  3.17.0306
AbstractAuthentication.php
1 <?php
2 // Copyright © 2017 Alexey Vaskovsky.
3 //
4 // This file is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 3.0 of the License, or (at your option) any later version.
8 //
9 // This file is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this file. If not, see
16 // <http://www.gnu.org/licenses/>
18 /**
19  * An abstract authentication.
20  *
21  * @author Alexey Vaskovsky
22  */
24 {
25  /**
26  * Performs authentication.
27  *
28  * @return true if user is authenticated; false otherwise.
29  */
30  public function authenticate();
31  /**
32  * Returns an account attribute.
33  *
34  * This method performs authentication if user is not authenticated yet,
35  * loads account attributes and returns a value of the specified attribute.
36  *
37  * @param string $name
38  * is an attribute name.
39  *
40  * @throws InvalidArgumentException if `$name` is empty.
41  *
42  * @return the attribute value or null if the authentication failed.
43  */
44  public function getAccountAttribute($name);
45  /**
46  * Creates a new password hash.
47  *
48  * @param string $password
49  * is a password string.
50  *
51  * @throws InvalidArgumentException if `$password` is null.
52  *
53  * @return a string that contains the password hash; never null.
54  */
55  public function getPasswordHash($password);
56  /**
57  * Signs out.
58  *
59  * @see #authenticate()
60  */
61  public function signOut();
62 }
getAccountAttribute($name)
Returns an account attribute.
getPasswordHash($password)
Creates a new password hash.