|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @copyright Copyright (c) 2019, Roeland Jago Douma <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* @author Arthur Schiwon <[email protected]> |
|
9
|
|
|
* @author Christoph Wurst <[email protected]> |
|
10
|
|
|
* |
|
11
|
|
|
* @license GNU AGPL version 3 or any later version |
|
12
|
|
|
* |
|
13
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
14
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
15
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
16
|
|
|
* License, or (at your option) any later version. |
|
17
|
|
|
* |
|
18
|
|
|
* This program is distributed in the hope that it will be useful, |
|
19
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21
|
|
|
* GNU Affero General Public License for more details. |
|
22
|
|
|
* |
|
23
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
24
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
25
|
|
|
* |
|
26
|
|
|
*/ |
|
27
|
|
|
|
|
28
|
|
|
namespace OCP\User\Events; |
|
29
|
|
|
|
|
30
|
|
|
use OCP\Authentication\IApacheBackend; |
|
31
|
|
|
use OCP\EventDispatcher\Event; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @since 18.0.0 |
|
35
|
|
|
*/ |
|
36
|
|
|
class BeforeUserLoggedInEvent extends Event { |
|
37
|
|
|
private string $username; |
|
38
|
|
|
private ?string $password; |
|
39
|
|
|
private ?IApacheBackend $backend; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @since 18.0.0 |
|
43
|
|
|
* @since 26.0.0 password can be null |
|
44
|
|
|
*/ |
|
45
|
|
|
public function __construct(string $username, ?string $password, ?IApacheBackend $backend = null) { |
|
46
|
|
|
parent::__construct(); |
|
47
|
|
|
$this->username = $username; |
|
48
|
|
|
$this->password = $password; |
|
49
|
|
|
$this->backend = $backend; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* returns the login name, which must not necessarily match to a user ID |
|
54
|
|
|
* |
|
55
|
|
|
* @since 18.0.0 |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getUsername(): string { |
|
58
|
|
|
return $this->username; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @since 18.0.0 |
|
63
|
|
|
* @since 26.0.0 value can be null |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getPassword(): ?string { |
|
66
|
|
|
return $this->password; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* return backend if available (or null) |
|
71
|
|
|
* |
|
72
|
|
|
* @return IApacheBackend|null |
|
73
|
|
|
* @since 26.0.0 |
|
74
|
|
|
*/ |
|
75
|
|
|
public function getBackend(): ?IApacheBackend { |
|
76
|
|
|
return $this->backend; |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|