Change factors code and update Response model tests
This commit is contained in:
parent
7ad4af8d91
commit
f4b8ae8b88
|
@ -551,12 +551,11 @@ class V20 extends Migration
|
|||
$document->setAttribute('expire', $expire);
|
||||
|
||||
$factors = match ($document->getAttribute('provider')) {
|
||||
Auth::SESSION_PROVIDER_MAGIC_URL,
|
||||
Auth::SESSION_PROVIDER_OAUTH2 => ['email'],
|
||||
Auth::SESSION_PROVIDER_EMAIL => ['password'],
|
||||
Auth::SESSION_PROVIDER_PHONE => ['phone'],
|
||||
Auth::SESSION_PROVIDER_ANONYMOUS => ['anonymous'],
|
||||
Auth::SESSION_PROVIDER_TOKEN => ['token'],
|
||||
default => ['password'],
|
||||
default => ['email'],
|
||||
};
|
||||
|
||||
$document->setAttribute('factors', $factors);
|
||||
|
|
|
@ -73,6 +73,8 @@ class V17Test extends TestCase
|
|||
'remove targets' => [
|
||||
[
|
||||
'targets' => 'test',
|
||||
'mfa' => 'test',
|
||||
'totp' => 'test',
|
||||
],
|
||||
[
|
||||
],
|
||||
|
@ -116,4 +118,71 @@ class V17Test extends TestCase
|
|||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function membershipProvider(): array
|
||||
{
|
||||
return [
|
||||
'remove mfa' => [
|
||||
[
|
||||
'mfa' => 'test',
|
||||
],
|
||||
[
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider membershipProvider
|
||||
*/
|
||||
public function testMembership(array $content, array $expected): void
|
||||
{
|
||||
$model = Response::MODEL_MEMBERSHIP;
|
||||
|
||||
$result = $this->filter->parse($content, $model);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function sessionProvider(): array
|
||||
{
|
||||
return [
|
||||
'remove factors and secrets' => [
|
||||
[
|
||||
'factors' => 'test',
|
||||
'secret' => 'test',
|
||||
],
|
||||
[
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider sessionProvider
|
||||
*/
|
||||
public function testSession(array $content, array $expected): void
|
||||
{
|
||||
$model = Response::MODEL_SESSION;
|
||||
|
||||
$result = $this->filter->parse($content, $model);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function webhookProvider(): array
|
||||
{
|
||||
return [
|
||||
'remove webhook additions' => [
|
||||
[
|
||||
'enabled' => true,
|
||||
'logs' => ['test', 'test'],
|
||||
'attempts' => 1
|
||||
],
|
||||
[
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue