Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Pop PHP Framework (http://www.popphp.org/)
4 *
5 * @link       https://github.com/popphp/popphp-framework
6 * @author     Nick Sagona, III <dev@nolainteractive.com>
7 * @copyright  Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)
8 * @license    http://www.popphp.org/license     New BSD License
9 */
10
11/**
12 * @namespace
13 */
14namespace Pop\Auth;
15
16/**
17 * Auth interface
18 *
19 * @category   Pop
20 * @package    Pop\Auth
21 * @author     Nick Sagona, III <dev@nolainteractive.com>
22 * @copyright  Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)
23 * @license    http://www.popphp.org/license     New BSD License
24 * @version    4.0.0
25 */
26interface AuthInterface
27{
28
29    /**
30     * Get the authentication result
31     *
32     * @return int
33     */
34    public function getResult(): int;
35
36    /**
37     * Determine if the authentication attempt was successful
38     *
39     * @return bool
40     */
41    public function isAuthenticated(): bool;
42
43    /**
44     * Get the username
45     *
46     * @return ?string
47     */
48    public function getUsername(): ?string;
49
50    /**
51     * Get the password
52     *
53     * @return ?string
54     */
55    public function getPassword(): ?string;
56
57    /**
58     * Set the username
59     *
60     * @param  string $username
61     * @return AuthInterface
62     */
63    public function setUsername(string $username): AuthInterface;
64
65    /**
66     * Set the password
67     *
68     * @param  string $password
69     * @return AuthInterface
70     */
71    public function setPassword(string $password): AuthInterface;
72
73    /**
74     * Method to authenticate
75     *
76     * @param  string $username
77     * @param  string $password
78     * @return int
79     */
80    public function authenticate(string $username, string $password): int;
81
82    /**
83     * Method to verify a password against a hash
84     *
85     * @param string $password
86     * @param string $hash
87     * @return bool
88     */
89    public function verify(string $password, string $hash): bool;
90
91}