|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Robin McCorkell <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* @license AGPL-3.0 |
|
8
|
|
|
* |
|
9
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
10
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
11
|
|
|
* as published by the Free Software Foundation. |
|
12
|
|
|
* |
|
13
|
|
|
* This program is distributed in the hope that it will be useful, |
|
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16
|
|
|
* GNU Affero General Public License for more details. |
|
17
|
|
|
* |
|
18
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
19
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
20
|
|
|
* |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
namespace OCA\Files_External\Lib\Auth\OpenStack; |
|
24
|
|
|
|
|
25
|
|
|
use \OCP\IL10N; |
|
26
|
|
|
use \OCA\Files_External\Lib\DefinitionParameter; |
|
27
|
|
|
use \OCA\Files_External\Lib\Auth\AuthMechanism; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* OpenStack Keystone authentication |
|
31
|
|
|
*/ |
|
32
|
|
View Code Duplication |
class OpenStackV2 extends AuthMechanism { |
|
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
public function __construct(IL10N $l) { |
|
35
|
|
|
$this |
|
36
|
|
|
->setIdentifier('openstack::openstack') |
|
37
|
|
|
->setScheme(self::SCHEME_OPENSTACK) |
|
38
|
|
|
->setText($l->t('OpenStack v2')) |
|
39
|
|
|
->addParameters([ |
|
40
|
|
|
new DefinitionParameter('user', $l->t('Username')), |
|
41
|
|
|
(new DefinitionParameter('password', $l->t('Password'))) |
|
42
|
|
|
->setType(DefinitionParameter::VALUE_PASSWORD), |
|
43
|
|
|
new DefinitionParameter('tenant', $l->t('Tenant name')), |
|
44
|
|
|
new DefinitionParameter('url', $l->t('Identity endpoint URL')), |
|
45
|
|
|
]) |
|
46
|
|
|
; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
} |
|
50
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.