Skip to content

Commit 631da09

Browse files
authored
Merge pull request #214 from magento-borg/MC-22950
MC-22950: Enable 2FA by default for Admins
2 parents 00d6d7d + 63c292b commit 631da09

File tree

221 files changed

+18857
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+18857
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TwoFactorAuth\Api;
9+
10+
use Magento\Framework\Api\SearchCriteriaInterface;
11+
use Magento\Framework\Api\SearchResultsInterface;
12+
use Magento\TwoFactorAuth\Api\Data\CountryInterface;
13+
use Magento\TwoFactorAuth\Api\Data\CountrySearchResultsInterface;
14+
15+
/**
16+
* Countries repository
17+
* @SuppressWarnings(PHPMD.ShortVariable)
18+
*/
19+
interface CountryRepositoryInterface
20+
{
21+
/**
22+
* Save object
23+
* @param CountryInterface $object
24+
* @return CountryInterface
25+
*/
26+
public function save(CountryInterface $object): CountryInterface;
27+
28+
/**
29+
* Get object by id
30+
* @param int $id
31+
* @return CountryInterface
32+
*/
33+
public function getById(int $id): CountryInterface;
34+
35+
/**
36+
* Get by Code value
37+
* @param string $value
38+
* @return CountryInterface
39+
*/
40+
public function getByCode(string $value): CountryInterface;
41+
42+
/**
43+
* Delete object
44+
* @param CountryInterface $object
45+
* @return void
46+
*/
47+
public function delete(CountryInterface $object): void;
48+
49+
/**
50+
* Get a list of object
51+
* @param SearchCriteriaInterface $searchCriteria
52+
* @return CountrySearchResultsInterface
53+
*/
54+
public function getList(SearchCriteriaInterface $searchCriteria): SearchResultsInterface;
55+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TwoFactorAuth\Api\Data;
9+
10+
use Magento\Framework\Api\ExtensibleDataInterface;
11+
12+
/**
13+
* Country entity interface
14+
*/
15+
interface CountryInterface extends ExtensibleDataInterface
16+
{
17+
/**
18+
* ID field name
19+
*/
20+
public const ID = 'country_id';
21+
22+
/**
23+
* Code field name
24+
*/
25+
public const CODE = 'code';
26+
27+
/**
28+
* Country name field name
29+
*/
30+
public const NAME = 'name';
31+
32+
/**
33+
* Dial code field name
34+
*/
35+
public const DIAL_CODE = 'dial_code';
36+
37+
/**
38+
* Get value for tfa_country_codes_id
39+
* @return int
40+
*/
41+
public function getId(): int;
42+
43+
/**
44+
* Set value for country_id
45+
* @param int $value
46+
*/
47+
public function setId(int $value): void;
48+
49+
/**
50+
* Get value for code
51+
* @return string
52+
*/
53+
public function getCode(): string;
54+
55+
/**
56+
* Set value for code
57+
* @param string $value
58+
*/
59+
public function setCode(string $value): void;
60+
61+
/**
62+
* Get value for name
63+
* @return string
64+
*/
65+
public function getName(): string;
66+
67+
/**
68+
* Set value for name
69+
* @param string $value
70+
*/
71+
public function setName(string $value): void;
72+
73+
/**
74+
* Get value for dial_code
75+
* @return string
76+
*/
77+
public function getDialCode(): string;
78+
79+
/**
80+
* Set value for dial_code
81+
* @param string $value
82+
*/
83+
public function setDialCode(string $value): void;
84+
85+
/**
86+
* Retrieve existing extension attributes object or create a new one
87+
*
88+
* Used fully qualified namespaces in annotations for proper work of extension interface/class code generation
89+
*
90+
* @return \Magento\TwoFactorAuth\Api\Data\CountryExtensionInterface|null
91+
*/
92+
public function getExtensionAttributes(): ?CountryExtensionInterface;
93+
94+
/**
95+
* Set an extension attributes object
96+
* @param \Magento\TwoFactorAuth\Api\Data\CountryExtensionInterface $extensionAttributes
97+
*/
98+
public function setExtensionAttributes(
99+
CountryExtensionInterface $extensionAttributes
100+
): void;
101+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TwoFactorAuth\Api\Data;
9+
10+
use Magento\Framework\Api\SearchResultsInterface;
11+
12+
/**
13+
* Country search results interface
14+
*/
15+
interface CountrySearchResultsInterface extends SearchResultsInterface
16+
{
17+
/**
18+
* Get an array of objects
19+
* @return CountryInterface[]
20+
*/
21+
public function getItems(): array;
22+
23+
/**
24+
* Set objects list
25+
* @param CountryInterface[] $items
26+
* @return CountrySearchResultsInterface
27+
*/
28+
public function setItems(array $items): CountrySearchResultsInterface;
29+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TwoFactorAuth\Api\Data;
9+
10+
use Magento\Framework\Api\ExtensibleDataInterface;
11+
12+
/**
13+
* User configuration interface
14+
*/
15+
interface UserConfigInterface extends ExtensibleDataInterface
16+
{
17+
/**
18+
* Entity ID field name
19+
*/
20+
public const ID = 'config_id';
21+
22+
/**
23+
* User ID field name
24+
*/
25+
public const USER_ID = 'user_id';
26+
27+
/**
28+
* Encoded providers filed name
29+
*/
30+
public const ENCODED_PROVIDERS = 'encoded_providers';
31+
32+
/**
33+
* Selected default provider field name
34+
*/
35+
public const DEFAULT_PROVIDER = 'default_provider';
36+
37+
/**
38+
* Get value for config_id
39+
* @return int
40+
*/
41+
public function getId(): int;
42+
43+
/**
44+
* Set value for config_id
45+
* @param int $value
46+
*/
47+
public function setId(int $value): void;
48+
49+
/**
50+
* Get value for user_id
51+
* @return int
52+
*/
53+
public function getUserId(): int;
54+
55+
/**
56+
* Set value for user_id
57+
* @param int $value
58+
*/
59+
public function setUserId(int $value): void;
60+
61+
/**
62+
* Get value for encoded_providers
63+
* @return string
64+
*/
65+
public function getEncodedProviders(): string;
66+
67+
/**
68+
* Set value for encoded_providers
69+
* @param string $value
70+
*/
71+
public function setEncodedProviders(string $value): void;
72+
73+
/**
74+
* Get value for default_provider
75+
* @return string
76+
*/
77+
public function getDefaultProvider(): string;
78+
79+
/**
80+
* Set value for default_provider
81+
* @param string $value
82+
*/
83+
public function setDefaultProvider(string $value): void;
84+
85+
/**
86+
* Retrieve existing extension attributes object or create a new one
87+
*
88+
* Used fully qualified namespaces in annotations for proper work of extension interface/class code generation
89+
*
90+
* @return \Magento\TwoFactorAuth\Api\Data\UserConfigExtensionInterface|null
91+
*/
92+
public function getExtensionAttributes(): ?UserConfigExtensionInterface;
93+
94+
/**
95+
* Set an extension attributes object
96+
* @param \Magento\TwoFactorAuth\Api\Data\UserConfigExtensionInterface $extensionAttributes
97+
*/
98+
public function setExtensionAttributes(UserConfigExtensionInterface $extensionAttributes): void;
99+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TwoFactorAuth\Api\Data;
9+
10+
use Magento\Framework\Api\SearchResultsInterface;
11+
12+
/**
13+
* User config search result
14+
*/
15+
interface UserConfigSearchResultsInterface extends SearchResultsInterface
16+
{
17+
/**
18+
* Get an array of objects
19+
* @return UserConfigInterface[]
20+
*/
21+
public function getItems(): array;
22+
23+
/**
24+
* Set objects list
25+
* @param UserConfigInterface[] $items
26+
* @return UserConfigSearchResultsInterface
27+
*/
28+
public function setItems(array $items): UserConfigSearchResultsInterface;
29+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TwoFactorAuth\Api;
9+
10+
use Magento\Framework\DataObject;
11+
use Magento\User\Api\Data\UserInterface;
12+
13+
/**
14+
* 2FA engine interface
15+
*/
16+
interface EngineInterface
17+
{
18+
/**
19+
* Return true if this provider has been enabled by admin
20+
*
21+
* @return bool
22+
*/
23+
public function isEnabled(): bool;
24+
25+
/**
26+
* Return true on token validation
27+
* @param UserInterface $user
28+
* @param DataObject $request
29+
* @return bool
30+
*/
31+
public function verify(UserInterface $user, DataObject $request): bool;
32+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\TwoFactorAuth\Api\Exception;
10+
11+
/**
12+
* Occurs when failed to notify a user.
13+
*/
14+
interface NotificationExceptionInterface extends \Throwable
15+
{
16+
17+
}

0 commit comments

Comments
 (0)