Skip to content

Commit 99f9bdb

Browse files
committed
ACP2E-2755: Issue with rest api after enable 2FA Duo
1 parent 54efe6d commit 99f9bdb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ class DuoSecurityTest extends TestCase
2222
*/
2323
private $model;
2424

25+
/**
26+
* @var DuoSecurity
27+
*/
28+
private $modelWithForcedDuoAuth;
29+
2530
/**
2631
* @var ScopeConfigInterface|MockObject
2732
*/
@@ -42,6 +47,7 @@ protected function setUp(): void
4247
$this->user = $this->getMockBuilder(UserInterface::class)->disableOriginalConstructor()->getMock();
4348

4449
$this->model = $objectManager->getObject(DuoSecurity::class, ['scopeConfig' => $this->configMock]);
50+
$this->modelWithForcedDuoAuth = new DuoSecurity($this->configMock, true);
4551
}
4652

4753
/**
@@ -137,5 +143,15 @@ public function testGetRequestSignature() : void
137143
->willReturn('SECRET');
138144

139145
$this->assertStringContainsString($this->model::AUTH_PREFIX, $this->model->getRequestSignature($this->user));
146+
$this->assertStringNotContainsString($this->model::DUO_PREFIX, $this->model->getRequestSignature($this->user));
147+
148+
$this->assertStringContainsString(
149+
$this->model::DUO_PREFIX,
150+
$this->modelWithForcedDuoAuth->getRequestSignature($this->user)
151+
);
152+
$this->assertStringNotContainsString(
153+
$this->model::AUTH_PREFIX,
154+
$this->modelWithForcedDuoAuth->getRequestSignature($this->user)
155+
);
140156
}
141157
}

0 commit comments

Comments
 (0)