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
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Auth;
16
17/**
18 * Auth interface
19 *
20 * @category   Pop
21 * @package    Pop\Auth
22 * @author     Nick Sagona, III <nick@popphp.org>
23 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
24 * @license    https://www.popphp.org/license     New BSD License
25 * @version    5.0.0
26 */
27interface AuthInterface
28{
29
30    /**
31     * Get the authentication result
32     *
33     * @return int
34     */
35    public function getResult(): int;
36
37    /**
38     * Determine if the authentication attempt was successful
39     *
40     * @return bool
41     */
42    public function isAuthenticated(): bool;
43
44    /**
45     * Determine if the last verified hash should be rehashed
46     *
47     * @return bool
48     */
49    public function needsRehash(): bool;
50
51    /**
52     * Get the username
53     *
54     * @return ?string
55     */
56    public function getUsername(): ?string;
57
58    /**
59     * Get the password
60     *
61     * @return ?string
62     */
63    public function getPassword(): ?string;
64
65    /**
66     * Set the username
67     *
68     * @param  string $username
69     * @return AuthInterface
70     */
71    public function setUsername(string $username): AuthInterface;
72
73    /**
74     * Set the password
75     *
76     * @param  string $password
77     * @return AuthInterface
78     */
79    public function setPassword(string $password): AuthInterface;
80
81    /**
82     * Method to authenticate
83     *
84     * @param  string  $credential
85     * @param  ?string $secondary
86     * @throws Exception
87     * @return int
88     */
89    public function authenticate(string $credential, ?string $secondary = null): int;
90
91    /**
92     * Method to verify a password against a hash
93     *
94     * @param string $password
95     * @param string $hash
96     * @return bool
97     */
98    public function verify(string $password, string $hash): bool;
99
100}