1: <?php
2:
3: /**
4: * This file is part of the Nette Framework.
5: *
6: * Copyright (c) 2004, 2010 David Grudl (http://davidgrudl.com)
7: *
8: * This source file is subject to the "Nette license", and/or
9: * GPL license. For more information please see http://nette.org
10: * @package Nette\Security
11: */
12:
13:
14:
15: /**
16: * Performs authentication.
17: *
18: * @author David Grudl
19: */
20: interface IAuthenticator
21: {
22: /**#@+ Credential key */
23: const USERNAME = 0;
24: const PASSWORD = 1;
25: /**#@-*/
26:
27: /**#@+ Exception error code */
28: const IDENTITY_NOT_FOUND = 1;
29: const INVALID_CREDENTIAL = 2;
30: const FAILURE = 3;
31: const NOT_APPROVED = 4;
32: /**#@-*/
33:
34: /**
35: * Performs an authentication against e.g. database.
36: * and returns IIdentity on success or throws NAuthenticationException
37: * @param array
38: * @return IIdentity
39: * @throws NAuthenticationException
40: */
41: function authenticate(array $credentials);
42:
43: }
44: