Skip to content

Commit f912e0b

Browse files
committed
AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for SVC failures
1 parent 69e0a83 commit f912e0b

File tree

7 files changed

+373
-14
lines changed

7 files changed

+373
-14
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
* Represents the data needed to use duo
14+
*
15+
* @deprecated This interface is no longer used.
16+
* @see none
17+
* @api
18+
*/
19+
interface DuoDataInterface extends ExtensibleDataInterface
20+
{
21+
/**
22+
* Signature field name
23+
*
24+
* @deprecated
25+
* @see none
26+
*/
27+
public const SIGNATURE = 'signature';
28+
29+
/**
30+
* Api host field name
31+
*
32+
* @deprecated
33+
* @see none
34+
*/
35+
public const API_HOSTNAME = 'api_hostname';
36+
37+
/**
38+
* Get the signature
39+
*
40+
* @deprecated
41+
* @see none
42+
* @return string
43+
*/
44+
public function getSignature(): string;
45+
46+
/**
47+
* Set the signature
48+
*
49+
* @deprecated
50+
* @see none
51+
* @param string $value
52+
* @return void
53+
*/
54+
public function setSignature(string $value): void;
55+
56+
/**
57+
* Set the api hostname
58+
*
59+
* @deprecated
60+
* @see none
61+
* @param string $value
62+
* @return void
63+
*/
64+
public function setApiHostname(string $value): void;
65+
66+
/**
67+
* Get the api hostname
68+
*
69+
* @deprecated
70+
* @see none
71+
* @return string
72+
*/
73+
public function getApiHostname(): string;
74+
75+
/**
76+
* Retrieve existing extension attributes object or create a new one
77+
*
78+
* Used fully qualified namespaces in annotations for proper work of extension interface/class code generation
79+
*
80+
* @deprecated
81+
* @see none
82+
* @return \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface|null
83+
*/
84+
public function getExtensionAttributes(): ?DuoDataExtensionInterface;
85+
86+
/**
87+
* Set an extension attributes object
88+
*
89+
* @deprecated
90+
* @see none
91+
* @param \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface $extensionAttributes
92+
* @return void
93+
*/
94+
public function setExtensionAttributes(
95+
DuoDataExtensionInterface $extensionAttributes
96+
): void;
97+
}

TwoFactorAuth/Api/DuoAuthenticateInterface.php

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,62 @@
11
<?php
22
/**
3-
* Copyright 2020 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66

77
declare(strict_types=1);
88

99
namespace Magento\TwoFactorAuth\Api;
1010

11+
use Magento\TwoFactorAuth\Api\Data\DuoDataInterface;
12+
1113
/**
1214
* Represents authentication for the duo security provider
1315
*
1416
* @api
1517
*/
1618
interface DuoAuthenticateInterface
1719
{
20+
/**
21+
* Get the information required to configure duo
22+
*
23+
* @deprecated this method is deprecated and will be removed in a future release.
24+
* @see none
25+
* @param string $username
26+
* @param string $password
27+
* @return \Magento\TwoFactorAuth\Api\Data\DuoDataInterface
28+
*/
29+
public function getAuthenticateData(
30+
string $username,
31+
string $password
32+
): DuoDataInterface;
33+
1834
/**
1935
* Authenticate and get an admin token
2036
*
37+
* @deprecated this method is deprecated and will be removed in a future release.
38+
* @see createAdminAccessTokenWithCredentialsAndPasscode
39+
*
2140
* @param string $username
2241
* @param string $password
23-
* @param string $passcode
42+
* @param string $signatureResponse
2443
* @return string
2544
*/
2645
public function createAdminAccessTokenWithCredentials(
46+
string $username,
47+
string $password,
48+
string $signatureResponse
49+
): string;
50+
51+
/**
52+
* Authenticate and get an admin token with passcode
53+
*
54+
* @param string $username
55+
* @param string $password
56+
* @param string $passcode
57+
* @return string
58+
*/
59+
public function createAdminAccessTokenWithCredentialsAndPasscode(
2760
string $username,
2861
string $password,
2962
string $passcode
Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,53 @@
11
<?php
22
/**
3-
* Copyright 2020 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66

77
declare(strict_types=1);
88

99
namespace Magento\TwoFactorAuth\Api;
1010

11+
use Magento\TwoFactorAuth\Api\Data\DuoDataInterface;
12+
1113
/**
1214
* Represents configuration for the duo security provider
1315
*
1416
* @api
1517
*/
1618
interface DuoConfigureInterface
1719
{
20+
/**
21+
* Get the information required to configure duo
22+
*
23+
* @deprecated this method is deprecated and will be removed in a future release.
24+
* @see getDuoConfigurationData
25+
*
26+
* @param string $tfaToken
27+
* @return \Magento\TwoFactorAuth\Api\Data\DuoDataInterface
28+
*/
29+
public function getConfigurationData(
30+
string $tfaToken
31+
): DuoDataInterface;
32+
33+
/**
34+
* Activate the provider and get an admin token
35+
*
36+
* @deprecated this method is deprecated and will be removed in a future release.
37+
* @see duoActivate
38+
* @param string $tfaToken
39+
* @param string $signatureResponse
40+
* @return void
41+
*/
42+
public function activate(string $tfaToken, string $signatureResponse): void;
43+
1844
/**
1945
* Configure duo for first time user
2046
*
2147
* @param string $tfaToken
2248
* @return void
2349
*/
24-
public function getConfigurationData(
50+
public function getDuoConfigurationData(
2551
string $tfaToken
2652
);
2753

@@ -31,5 +57,5 @@ public function getConfigurationData(
3157
* @param string $tfaToken
3258
* @return void
3359
*/
34-
public function activate(string $tfaToken): void;
60+
public function duoActivate(string $tfaToken): void;
3561
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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\Model\Data\Provider\Engine\DuoSecurity;
10+
11+
use Magento\Framework\Model\AbstractExtensibleModel;
12+
use Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface;
13+
14+
/**
15+
* This class was originally implementing Magento\TwoFactorAuth\Api\Data\DuoDataInterface.
16+
* It no longer implements the interface but maintains backward compatibility.
17+
* Represents the data needed to authenticate with duo
18+
*/
19+
class Data extends AbstractExtensibleModel
20+
{
21+
/**
22+
* Signature field name
23+
*/
24+
public const SIGNATURE = 'signature';
25+
26+
/**
27+
* Api host field name
28+
*/
29+
public const API_HOSTNAME = 'api_hostname';
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
public function getSignature(): string
35+
{
36+
return (string)$this->getData(self::SIGNATURE);
37+
}
38+
39+
/**
40+
* @inheritDoc
41+
*/
42+
public function setSignature(string $value): void
43+
{
44+
$this->setData(self::SIGNATURE, $value);
45+
}
46+
47+
/**
48+
* @inheritDoc
49+
*/
50+
public function getApiHostname(): string
51+
{
52+
return (string)$this->getData(self::API_HOSTNAME);
53+
}
54+
55+
/**
56+
* @inheritDoc
57+
*/
58+
public function setApiHostname(string $value): void
59+
{
60+
$this->setData(self::API_HOSTNAME, $value);
61+
}
62+
63+
/**
64+
* Retrieve existing extension attributes object or create a new one
65+
*
66+
* Used fully qualified namespaces in annotations for proper work of extension interface/class code generation
67+
*
68+
* @return \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface|null
69+
*/
70+
public function getExtensionAttributes(): ?DuoDataExtensionInterface
71+
{
72+
return $this->getData(self::EXTENSION_ATTRIBUTES_KEY);
73+
}
74+
75+
/**
76+
* Set an extension attributes object
77+
*
78+
* @param \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface $extensionAttributes
79+
* @return void
80+
*/
81+
public function setExtensionAttributes(DuoDataExtensionInterface $extensionAttributes): void
82+
{
83+
$this->setData(self::EXTENSION_ATTRIBUTES_KEY, $extensionAttributes);
84+
}
85+
}

0 commit comments

Comments
 (0)