1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* @author Rainer Dohmen <[email protected]> |
7
|
|
|
* |
8
|
|
|
* Nextcloud - Two-factor Gateway |
9
|
|
|
* |
10
|
|
|
* This code is free software: you can redistribute it and/or modify |
11
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
12
|
|
|
* as published by the Free Software Foundation. |
13
|
|
|
* |
14
|
|
|
* This program is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU Affero General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
20
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
21
|
|
|
* |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
namespace OCA\TwoFactorGateway\Provider; |
25
|
|
|
|
26
|
|
|
use OCA\TwoFactorGateway\Service\Gateway\XMPP\Gateway; |
27
|
|
|
use OCA\TwoFactorGateway\Service\StateStorage; |
28
|
|
|
use OCP\IL10N; |
29
|
|
|
use OCP\ISession; |
30
|
|
|
use OCP\Security\ISecureRandom; |
31
|
|
|
|
32
|
|
|
class XMPPProvider extends AProvider { |
33
|
|
|
public function __construct(Gateway $smsGateway, |
34
|
|
|
StateStorage $stateStorage, |
35
|
|
|
ISession $session, |
36
|
|
|
ISecureRandom $secureRandom, |
37
|
|
|
IL10N $l10n) { |
38
|
|
|
parent::__construct( |
39
|
|
|
'xmpp', |
40
|
|
|
$smsGateway, |
41
|
|
|
$stateStorage, |
42
|
|
|
$session, |
43
|
|
|
$secureRandom, |
44
|
|
|
$l10n |
45
|
|
|
); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Get unique identifier of this 2FA provider |
50
|
|
|
*/ |
51
|
|
|
public function getId(): string { |
52
|
|
|
return 'gateway_xmpp'; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Get the display name for selecting the 2FA provider |
57
|
|
|
*/ |
58
|
|
|
public function getDisplayName(): string { |
59
|
|
|
return $this->l10n->t('XMPP verification'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get the description for selecting the 2FA provider |
64
|
|
|
*/ |
65
|
|
|
public function getDescription(): string { |
66
|
|
|
return $this->l10n->t('Authenticate via XMPP'); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|