Skip to content

Commit 09de951

Browse files
Update generated code (#1762)
update generated code
1 parent edd6066 commit 09de951

11 files changed

+186
-56
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
- AWS api-change: Added `PasswordHistoryPolicyViolationException` exception.
8+
- AWS api-change: Added email MFA option to user pools with advanced security features.
89

910
### Changed
1011

src/CognitoIdentityProviderClient.php

Lines changed: 53 additions & 45 deletions
Large diffs are not rendered by default.

src/Enum/ChallengeNameType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ final class ChallengeNameType
88
public const CUSTOM_CHALLENGE = 'CUSTOM_CHALLENGE';
99
public const DEVICE_PASSWORD_VERIFIER = 'DEVICE_PASSWORD_VERIFIER';
1010
public const DEVICE_SRP_AUTH = 'DEVICE_SRP_AUTH';
11+
public const EMAIL_OTP = 'EMAIL_OTP';
1112
public const MFA_SETUP = 'MFA_SETUP';
1213
public const NEW_PASSWORD_REQUIRED = 'NEW_PASSWORD_REQUIRED';
1314
public const PASSWORD_VERIFIER = 'PASSWORD_VERIFIER';
@@ -22,6 +23,7 @@ public static function exists(string $value): bool
2223
self::CUSTOM_CHALLENGE => true,
2324
self::DEVICE_PASSWORD_VERIFIER => true,
2425
self::DEVICE_SRP_AUTH => true,
26+
self::EMAIL_OTP => true,
2527
self::MFA_SETUP => true,
2628
self::NEW_PASSWORD_REQUIRED => true,
2729
self::PASSWORD_VERIFIER => true,

src/Input/RespondToAuthChallengeRequest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,16 @@ final class RespondToAuthChallengeRequest extends Input
5555
*
5656
* - `SMS_MFA`:
5757
*
58-
* `"ChallengeName": "SMS_MFA", "ChallengeResponses": {"SMS_MFA_CODE": "[SMS_code]", "USERNAME": "[username]"}`
58+
* `"ChallengeName": "SMS_MFA", "ChallengeResponses": {"SMS_MFA_CODE": "[code]", "USERNAME": "[username]"}`
59+
* - `EMAIL_OTP`:
60+
*
61+
* `"ChallengeName": "EMAIL_OTP", "ChallengeResponses": {"EMAIL_OTP_CODE": "[code]", "USERNAME": "[username]"}`
5962
* - `PASSWORD_VERIFIER`:
6063
*
64+
* This challenge response is part of the SRP flow. Amazon Cognito requires that your application respond to this
65+
* challenge within a few seconds. When the response time exceeds this period, your user pool returns a
66+
* `NotAuthorizedException` error.
67+
*
6168
* `"ChallengeName": "PASSWORD_VERIFIER", "ChallengeResponses": {"PASSWORD_CLAIM_SIGNATURE": "[claim_signature]",
6269
* "PASSWORD_CLAIM_SECRET_BLOCK": "[secret_block]", "TIMESTAMP": [timestamp], "USERNAME": "[username]"}`
6370
*

src/Input/SetUserMFAPreferenceRequest.php

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace AsyncAws\CognitoIdentityProvider\Input;
44

5+
use AsyncAws\CognitoIdentityProvider\ValueObject\EmailMfaSettingsType;
56
use AsyncAws\CognitoIdentityProvider\ValueObject\SMSMfaSettingsType;
67
use AsyncAws\CognitoIdentityProvider\ValueObject\SoftwareTokenMfaSettingsType;
78
use AsyncAws\Core\Exception\InvalidArgument;
@@ -12,19 +13,32 @@
1213
final class SetUserMFAPreferenceRequest extends Input
1314
{
1415
/**
15-
* The SMS text message multi-factor authentication (MFA) settings.
16+
* User preferences for SMS message MFA. Activates or deactivates SMS MFA and sets it as the preferred MFA method when
17+
* multiple methods are available.
1618
*
1719
* @var SMSMfaSettingsType|null
1820
*/
1921
private $smsMfaSettings;
2022

2123
/**
22-
* The time-based one-time password (TOTP) software token MFA settings.
24+
* User preferences for time-based one-time password (TOTP) MFA. Activates or deactivates TOTP MFA and sets it as the
25+
* preferred MFA method when multiple methods are available.
2326
*
2427
* @var SoftwareTokenMfaSettingsType|null
2528
*/
2629
private $softwareTokenMfaSettings;
2730

31+
/**
32+
* User preferences for email message MFA. Activates or deactivates email MFA and sets it as the preferred MFA method
33+
* when multiple methods are available. To activate this setting, advanced security features [^1] must be active in your
34+
* user pool.
35+
*
36+
* [^1]: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security.html
37+
*
38+
* @var EmailMfaSettingsType|null
39+
*/
40+
private $emailMfaSettings;
41+
2842
/**
2943
* A valid access token that Amazon Cognito issued to the user whose MFA preference you want to set.
3044
*
@@ -38,6 +52,7 @@ final class SetUserMFAPreferenceRequest extends Input
3852
* @param array{
3953
* SMSMfaSettings?: null|SMSMfaSettingsType|array,
4054
* SoftwareTokenMfaSettings?: null|SoftwareTokenMfaSettingsType|array,
55+
* EmailMfaSettings?: null|EmailMfaSettingsType|array,
4156
* AccessToken?: string,
4257
* '@region'?: string|null,
4358
* } $input
@@ -46,6 +61,7 @@ public function __construct(array $input = [])
4661
{
4762
$this->smsMfaSettings = isset($input['SMSMfaSettings']) ? SMSMfaSettingsType::create($input['SMSMfaSettings']) : null;
4863
$this->softwareTokenMfaSettings = isset($input['SoftwareTokenMfaSettings']) ? SoftwareTokenMfaSettingsType::create($input['SoftwareTokenMfaSettings']) : null;
64+
$this->emailMfaSettings = isset($input['EmailMfaSettings']) ? EmailMfaSettingsType::create($input['EmailMfaSettings']) : null;
4965
$this->accessToken = $input['AccessToken'] ?? null;
5066
parent::__construct($input);
5167
}
@@ -54,6 +70,7 @@ public function __construct(array $input = [])
5470
* @param array{
5571
* SMSMfaSettings?: null|SMSMfaSettingsType|array,
5672
* SoftwareTokenMfaSettings?: null|SoftwareTokenMfaSettingsType|array,
73+
* EmailMfaSettings?: null|EmailMfaSettingsType|array,
5774
* AccessToken?: string,
5875
* '@region'?: string|null,
5976
* }|SetUserMFAPreferenceRequest $input
@@ -68,6 +85,11 @@ public function getAccessToken(): ?string
6885
return $this->accessToken;
6986
}
7087

88+
public function getEmailMfaSettings(): ?EmailMfaSettingsType
89+
{
90+
return $this->emailMfaSettings;
91+
}
92+
7193
public function getSmsMfaSettings(): ?SMSMfaSettingsType
7294
{
7395
return $this->smsMfaSettings;
@@ -111,6 +133,13 @@ public function setAccessToken(?string $value): self
111133
return $this;
112134
}
113135

136+
public function setEmailMfaSettings(?EmailMfaSettingsType $value): self
137+
{
138+
$this->emailMfaSettings = $value;
139+
140+
return $this;
141+
}
142+
114143
public function setSmsMfaSettings(?SMSMfaSettingsType $value): self
115144
{
116145
$this->smsMfaSettings = $value;
@@ -134,6 +163,9 @@ private function requestBody(): array
134163
if (null !== $v = $this->softwareTokenMfaSettings) {
135164
$payload['SoftwareTokenMfaSettings'] = $v->requestBody();
136165
}
166+
if (null !== $v = $this->emailMfaSettings) {
167+
$payload['EmailMfaSettings'] = $v->requestBody();
168+
}
137169
if (null === $v = $this->accessToken) {
138170
throw new InvalidArgument(\sprintf('Missing parameter "AccessToken" for "%s". The value cannot be null.', __CLASS__));
139171
}

src/Result/AdminGetUserResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class AdminGetUserResponse extends Result
8181
private $preferredMfaSetting;
8282

8383
/**
84-
* The MFA options that are activated for the user. The possible values in this list are `SMS_MFA` and
84+
* The MFA options that are activated for the user. The possible values in this list are `SMS_MFA`, `EMAIL_OTP`, and
8585
* `SOFTWARE_TOKEN_MFA`.
8686
*
8787
* @var string[]

src/Result/AdminInitiateAuthResponse.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ class AdminInitiateAuthResponse extends Result
1919
*
2020
* - `MFA_SETUP`: If MFA is required, users who don't have at least one of the MFA methods set up are presented with an
2121
* `MFA_SETUP` challenge. The user must set up at least one MFA type to continue to authenticate.
22-
* - `SELECT_MFA_TYPE`: Selects the MFA type. Valid MFA options are `SMS_MFA` for text SMS MFA, and `SOFTWARE_TOKEN_MFA`
23-
* for time-based one-time password (TOTP) software token MFA.
24-
* - `SMS_MFA`: Next challenge is to supply an `SMS_MFA_CODE`, delivered via SMS.
22+
* - `SELECT_MFA_TYPE`: Selects the MFA type. Valid MFA options are `SMS_MFA` for SMS message MFA, `EMAIL_OTP` for email
23+
* message MFA, and `SOFTWARE_TOKEN_MFA` for time-based one-time password (TOTP) software token MFA.
24+
* - `SMS_MFA`: Next challenge is to supply an `SMS_MFA_CODE`that your user pool delivered in an SMS message.
25+
* - `EMAIL_OTP`: Next challenge is to supply an `EMAIL_OTP_CODE` that your user pool delivered in an email message.
2526
* - `PASSWORD_VERIFIER`: Next challenge is to supply `PASSWORD_CLAIM_SIGNATURE`, `PASSWORD_CLAIM_SECRET_BLOCK`, and
2627
* `TIMESTAMP` after the client-side SRP calculations.
2728
* - `CUSTOM_CHALLENGE`: This is returned if your custom authentication flow determines that the user should pass

src/Result/GetUserResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class GetUserResponse extends Result
4545
private $preferredMfaSetting;
4646

4747
/**
48-
* The MFA options that are activated for the user. The possible values in this list are `SMS_MFA` and
48+
* The MFA options that are activated for the user. The possible values in this list are `SMS_MFA`, `EMAIL_OTP`, and
4949
* `SOFTWARE_TOKEN_MFA`.
5050
*
5151
* @var string[]

src/Result/InitiateAuthResponse.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class InitiateAuthResponse extends Result
2121
*
2222
* > All of the following challenges require `USERNAME` and `SECRET_HASH` (if applicable) in the parameters.
2323
*
24-
* - `SMS_MFA`: Next challenge is to supply an `SMS_MFA_CODE`, delivered via SMS.
24+
* - `SMS_MFA`: Next challenge is to supply an `SMS_MFA_CODE`that your user pool delivered in an SMS message.
25+
* - `EMAIL_OTP`: Next challenge is to supply an `EMAIL_OTP_CODE` that your user pool delivered in an email message.
2526
* - `PASSWORD_VERIFIER`: Next challenge is to supply `PASSWORD_CLAIM_SIGNATURE`, `PASSWORD_CLAIM_SECRET_BLOCK`, and
2627
* `TIMESTAMP` after the client-side SRP calculations.
2728
* - `CUSTOM_CHALLENGE`: This is returned if your custom authentication flow determines that the user should pass
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
3+
namespace AsyncAws\CognitoIdentityProvider\ValueObject;
4+
5+
/**
6+
* User preferences for multi-factor authentication with email messages. Activates or deactivates email MFA and sets it
7+
* as the preferred MFA method when multiple methods are available. To activate this setting, advanced security features
8+
* [^1] must be active in your user pool.
9+
*
10+
* [^1]: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security.html
11+
*/
12+
final class EmailMfaSettingsType
13+
{
14+
/**
15+
* Specifies whether email message MFA is active for a user. When the value of this parameter is `Enabled`, the user
16+
* will be prompted for MFA during all sign-in attempts, unless device tracking is turned on and the device has been
17+
* trusted.
18+
*
19+
* @var bool|null
20+
*/
21+
private $enabled;
22+
23+
/**
24+
* Specifies whether email message MFA is the user's preferred method.
25+
*
26+
* @var bool|null
27+
*/
28+
private $preferredMfa;
29+
30+
/**
31+
* @param array{
32+
* Enabled?: null|bool,
33+
* PreferredMfa?: null|bool,
34+
* } $input
35+
*/
36+
public function __construct(array $input)
37+
{
38+
$this->enabled = $input['Enabled'] ?? null;
39+
$this->preferredMfa = $input['PreferredMfa'] ?? null;
40+
}
41+
42+
/**
43+
* @param array{
44+
* Enabled?: null|bool,
45+
* PreferredMfa?: null|bool,
46+
* }|EmailMfaSettingsType $input
47+
*/
48+
public static function create($input): self
49+
{
50+
return $input instanceof self ? $input : new self($input);
51+
}
52+
53+
public function getEnabled(): ?bool
54+
{
55+
return $this->enabled;
56+
}
57+
58+
public function getPreferredMfa(): ?bool
59+
{
60+
return $this->preferredMfa;
61+
}
62+
63+
/**
64+
* @internal
65+
*/
66+
public function requestBody(): array
67+
{
68+
$payload = [];
69+
if (null !== $v = $this->enabled) {
70+
$payload['Enabled'] = (bool) $v;
71+
}
72+
if (null !== $v = $this->preferredMfa) {
73+
$payload['PreferredMfa'] = (bool) $v;
74+
}
75+
76+
return $payload;
77+
}
78+
}

0 commit comments

Comments
 (0)