1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://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: * Performs authentication.
17: *
18: * @author David Grudl
19: * @package Nette\Security
20: */
21: interface IAuthenticator
22: {
23: /**#@+ Credential key */
24: const USERNAME = 'username';
25: const PASSWORD = 'password';
26: /**#@-*/
27:
28: /**#@+ Exception error code */
29: const IDENTITY_NOT_FOUND = 1;
30: const INVALID_CREDENTIAL = 2;
31: const FAILURE = 3;
32: const NOT_APPROVED = 4;
33: /**#@-*/
34:
35: /**
36: * Performs an authentication against e.g. database.
37: * and returns IIdentity on success or throws NAuthenticationException
38: * @param array
39: * @return IIdentity
40: * @throws NAuthenticationException
41: */
42: function authenticate(array $credentials);
43:
44: }
45: