Skip to content

Commit 7b38ae7

Browse files
Update generated code (#1807)
* update generated code * fix psalm --------- Co-authored-by: Jérémy Derussé <[email protected]>
1 parent 467a79e commit 7b38ae7

36 files changed

+590
-155
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"variables": {
3-
"${LATEST}": "3.329.0"
3+
"${LATEST}": "3.330.0"
44
},
55
"endpoints": "https://raw.githubusercontent.com/aws/aws-sdk-php/${LATEST}/src/data/endpoints.json",
66
"services": {

psalm.baseline.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,12 @@
312312
<code><![CDATA[list<Architecture::*>]]></code>
313313
</MoreSpecificReturnType>
314314
</file>
315+
<file src="src/Service/CognitoIdentityProvider/src/Result/InitiateAuthResponse.php">
316+
<LessSpecificReturnStatement>
317+
<code><![CDATA[$items]]></code>
318+
</LessSpecificReturnStatement>
319+
<MoreSpecificReturnType>
320+
<code><![CDATA[list<ChallengeNameType::*>]]></code>
321+
</MoreSpecificReturnType>
322+
</file>
315323
</files>

src/Service/CognitoIdentityProvider/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Added
6+
7+
- AWS api-change: Add support for users to sign up and sign in without passwords, using email and SMS OTPs and Passkeys. Add support for Passkeys based on WebAuthn. Add support for enhanced branding customization for hosted authentication pages with Amazon Cognito Managed Login. Add feature tiers with new pricing.
8+
59
### Changed
610

711
- use strict comparison `null !==` instead of `!`

src/Service/CognitoIdentityProvider/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"extra": {
3030
"branch-alias": {
31-
"dev-master": "1.9-dev"
31+
"dev-master": "1.10-dev"
3232
}
3333
}
3434
}

src/Service/CognitoIdentityProvider/src/CognitoIdentityProviderClient.php

Lines changed: 65 additions & 49 deletions
Large diffs are not rendered by default.

src/Service/CognitoIdentityProvider/src/Enum/AuthFlowType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ final class AuthFlowType
99
public const CUSTOM_AUTH = 'CUSTOM_AUTH';
1010
public const REFRESH_TOKEN = 'REFRESH_TOKEN';
1111
public const REFRESH_TOKEN_AUTH = 'REFRESH_TOKEN_AUTH';
12+
public const USER_AUTH = 'USER_AUTH';
1213
public const USER_PASSWORD_AUTH = 'USER_PASSWORD_AUTH';
1314
public const USER_SRP_AUTH = 'USER_SRP_AUTH';
1415

@@ -20,6 +21,7 @@ public static function exists(string $value): bool
2021
self::CUSTOM_AUTH => true,
2122
self::REFRESH_TOKEN => true,
2223
self::REFRESH_TOKEN_AUTH => true,
24+
self::USER_AUTH => true,
2325
self::USER_PASSWORD_AUTH => true,
2426
self::USER_SRP_AUTH => true,
2527
][$value]);

src/Service/CognitoIdentityProvider/src/Enum/ChallengeNameType.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ final class ChallengeNameType
1111
public const EMAIL_OTP = 'EMAIL_OTP';
1212
public const MFA_SETUP = 'MFA_SETUP';
1313
public const NEW_PASSWORD_REQUIRED = 'NEW_PASSWORD_REQUIRED';
14+
public const PASSWORD = 'PASSWORD';
15+
public const PASSWORD_SRP = 'PASSWORD_SRP';
1416
public const PASSWORD_VERIFIER = 'PASSWORD_VERIFIER';
17+
public const SELECT_CHALLENGE = 'SELECT_CHALLENGE';
1518
public const SELECT_MFA_TYPE = 'SELECT_MFA_TYPE';
1619
public const SMS_MFA = 'SMS_MFA';
20+
public const SMS_OTP = 'SMS_OTP';
1721
public const SOFTWARE_TOKEN_MFA = 'SOFTWARE_TOKEN_MFA';
22+
public const WEB_AUTHN = 'WEB_AUTHN';
1823

1924
public static function exists(string $value): bool
2025
{
@@ -26,10 +31,15 @@ public static function exists(string $value): bool
2631
self::EMAIL_OTP => true,
2732
self::MFA_SETUP => true,
2833
self::NEW_PASSWORD_REQUIRED => true,
34+
self::PASSWORD => true,
35+
self::PASSWORD_SRP => true,
2936
self::PASSWORD_VERIFIER => true,
37+
self::SELECT_CHALLENGE => true,
3038
self::SELECT_MFA_TYPE => true,
3139
self::SMS_MFA => true,
40+
self::SMS_OTP => true,
3241
self::SOFTWARE_TOKEN_MFA => true,
42+
self::WEB_AUTHN => true,
3343
][$value]);
3444
}
3545
}

src/Service/CognitoIdentityProvider/src/Exception/InvalidParameterException.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,29 @@
33
namespace AsyncAws\CognitoIdentityProvider\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6+
use Symfony\Contracts\HttpClient\ResponseInterface;
67

78
/**
89
* This exception is thrown when the Amazon Cognito service encounters an invalid parameter.
910
*/
1011
final class InvalidParameterException extends ClientException
1112
{
13+
/**
14+
* The reason code of the exception.
15+
*
16+
* @var string|null
17+
*/
18+
private $reasonCode;
19+
20+
public function getReasonCode(): ?string
21+
{
22+
return $this->reasonCode;
23+
}
24+
25+
protected function populateResult(ResponseInterface $response): void
26+
{
27+
$data = $response->toArray(false);
28+
29+
$this->reasonCode = isset($data['reasonCode']) ? (string) $data['reasonCode'] : null;
30+
}
1231
}

src/Service/CognitoIdentityProvider/src/Input/AdminCreateUserRequest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use AsyncAws\Core\Stream\StreamFactory;
1212

1313
/**
14-
* Represents the request to create a user in the specified user pool.
14+
* Creates a new user in the specified user pool.
1515
*/
1616
final class AdminCreateUserRequest extends Input
1717
{
@@ -55,6 +55,10 @@ final class AdminCreateUserRequest extends Input
5555
* this in your call to AdminCreateUser or in the **Users** tab of the Amazon Cognito console for managing your user
5656
* pools.
5757
*
58+
* You must also provide an email address or phone number when you expect the user to do passwordless sign-in with an
59+
* email or SMS OTP. These attributes must be provided when passwordless options are the only available, or when you
60+
* don't submit a `TemporaryPassword`.
61+
*
5862
* In your call to `AdminCreateUser`, you can set the `email_verified` attribute to `True`, and you can set the
5963
* `phone_number_verified` attribute to `True`. You can also do this by calling AdminUpdateUserAttributes [^1].
6064
*
@@ -92,15 +96,25 @@ final class AdminCreateUserRequest extends Input
9296
* The user's temporary password. This password must conform to the password policy that you specified when you created
9397
* the user pool.
9498
*
99+
* The exception to the requirement for a password is when your user pool supports passwordless sign-in with email or
100+
* SMS OTPs. To create a user with no password, omit this parameter or submit a blank value. You can only create a
101+
* passwordless user when passwordless sign-in is available. See the SignInPolicyType [^1] property of CreateUserPool
102+
* [^2] and UpdateUserPool [^3].
103+
*
95104
* The temporary password is valid only once. To complete the Admin Create User flow, the user must enter the temporary
96105
* password in the sign-in page, along with a new password to be used in all future sign-ins.
97106
*
98-
* This parameter isn't required. If you don't specify a value, Amazon Cognito generates one for you.
107+
* If you don't specify a value, Amazon Cognito generates one for you unless you have passwordless options active for
108+
* your user pool.
99109
*
100110
* The temporary password can only be used until the user account expiration limit that you set for your user pool. To
101111
* reset the account after that time limit, you must call `AdminCreateUser` again and specify `RESEND` for the
102112
* `MessageAction` parameter.
103113
*
114+
* [^1]: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_SignInPolicyType.html
115+
* [^2]: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateUserPool.html
116+
* [^3]: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UpdateUserPool.html
117+
*
104118
* @var string|null
105119
*/
106120
private $temporaryPassword;

src/Service/CognitoIdentityProvider/src/Input/AdminInitiateAuthRequest.php

Lines changed: 70 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,48 @@ final class AdminInitiateAuthRequest extends Input
3434
private $clientId;
3535

3636
/**
37-
* The authentication flow for this call to run. The API action will depend on this value. For example:
37+
* The authentication flow that you want to initiate. The `AuthParameters` that you must submit are linked to the flow
38+
* that you submit. For example:
3839
*
39-
* - `REFRESH_TOKEN_AUTH` will take in a valid refresh token and return new tokens.
40-
* - `USER_SRP_AUTH` will take in `USERNAME` and `SRP_A` and return the Secure Remote Password (SRP) protocol variables
41-
* to be used for next challenge execution.
42-
* - `ADMIN_USER_PASSWORD_AUTH` will take in `USERNAME` and `PASSWORD` and return the next challenge or tokens.
40+
* - `USER_AUTH`: Request a preferred authentication type or review available authentication types. From the offered
41+
* authentication types, select one in a challenge response and then authenticate with that method in an additional
42+
* challenge response.
43+
* - `REFRESH_TOKEN_AUTH`: Receive new ID and access tokens when you pass a `REFRESH_TOKEN` parameter with a valid
44+
* refresh token as the value.
45+
* - `USER_SRP_AUTH`: Receive secure remote password (SRP) variables for the next challenge, `PASSWORD_VERIFIER`, when
46+
* you pass `USERNAME` and `SRP_A` parameters..
47+
* - `ADMIN_USER_PASSWORD_AUTH`: Receive new tokens or the next challenge, for example `SOFTWARE_TOKEN_MFA`, when you
48+
* pass `USERNAME` and `PASSWORD` parameters.
4349
*
44-
* Valid values include:
50+
* Valid values include the following:
4551
*
46-
* - `USER_SRP_AUTH`: Authentication flow for the Secure Remote Password (SRP) protocol.
47-
* - `REFRESH_TOKEN_AUTH`/`REFRESH_TOKEN`: Authentication flow for refreshing the access token and ID token by supplying
48-
* a valid refresh token.
49-
* - `CUSTOM_AUTH`: Custom authentication flow.
50-
* - `ADMIN_NO_SRP_AUTH`: Non-SRP authentication flow; you can pass in the USERNAME and PASSWORD directly if the flow is
51-
* enabled for calling the app client.
52-
* - `ADMIN_USER_PASSWORD_AUTH`: Admin-based user password authentication. This replaces the `ADMIN_NO_SRP_AUTH`
53-
* authentication flow. In this flow, Amazon Cognito receives the password in the request instead of using the SRP
54-
* process to verify passwords.
52+
* - `USER_AUTH`:
53+
*
54+
* The entry point for sign-in with passwords, one-time passwords, biometric devices, and security keys.
55+
* - `USER_SRP_AUTH`:
56+
*
57+
* Username-password authentication with the Secure Remote Password (SRP) protocol. For more information, see Use SRP
58+
* password verification in custom authentication flow [^1].
59+
* - `REFRESH_TOKEN_AUTH and REFRESH_TOKEN`:
60+
*
61+
* Provide a valid refresh token and receive new ID and access tokens. For more information, see Using the refresh
62+
* token [^2].
63+
* - `CUSTOM_AUTH`:
64+
*
65+
* Custom authentication with Lambda triggers. For more information, see Custom authentication challenge Lambda
66+
* triggers [^3].
67+
* - `ADMIN_USER_PASSWORD_AUTH`:
68+
*
69+
* Username-password authentication with the password sent directly in the request. For more information, see Admin
70+
* authentication flow [^4].
71+
*
72+
* `USER_PASSWORD_AUTH` is a flow type of InitiateAuth [^5] and isn't valid for AdminInitiateAuth.
73+
*
74+
* [^1]: https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html#Using-SRP-password-verification-in-custom-authentication-flow
75+
* [^2]: https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-refresh-token.html
76+
* [^3]: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-challenge.html
77+
* [^4]: https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html#Built-in-authentication-flow-and-challenges
78+
* [^5]: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_InitiateAuth.html
5579
*
5680
* @required
5781
*
@@ -63,6 +87,9 @@ final class AdminInitiateAuthRequest extends Input
6387
* The authentication parameters. These are inputs corresponding to the `AuthFlow` that you're invoking. The required
6488
* values depend on the value of `AuthFlow`:
6589
*
90+
* - For `USER_AUTH`: `USERNAME` (required), `PREFERRED_CHALLENGE`. If you don't provide a value for
91+
* `PREFERRED_CHALLENGE`, Amazon Cognito responds with the `AvailableChallenges` parameter that specifies the
92+
* available sign-in methods.
6693
* - For `USER_SRP_AUTH`: `USERNAME` (required), `SRP_A` (required), `SECRET_HASH` (required if the app client is
6794
* configured with a client secret), `DEVICE_KEY`.
6895
* - For `ADMIN_USER_PASSWORD_AUTH`: `USERNAME` (required), `PASSWORD` (required), `SECRET_HASH` (required if the app
@@ -107,6 +134,8 @@ final class AdminInitiateAuthRequest extends Input
107134
* - Pre token generation
108135
* - Create auth challenge
109136
* - Define auth challenge
137+
* - Custom email sender
138+
* - Custom SMS sender
110139
*
111140
* For more information, see Customizing user pool Workflows with Lambda Triggers [^1] in the *Amazon Cognito Developer
112141
* Guide*.
@@ -142,6 +171,14 @@ final class AdminInitiateAuthRequest extends Input
142171
*/
143172
private $contextData;
144173

174+
/**
175+
* The optional session ID from a `ConfirmSignUp` API request. You can sign in a user directly from the sign-up process
176+
* with the `USER_AUTH` authentication flow.
177+
*
178+
* @var string|null
179+
*/
180+
private $session;
181+
145182
/**
146183
* @param array{
147184
* UserPoolId?: string,
@@ -151,6 +188,7 @@ final class AdminInitiateAuthRequest extends Input
151188
* ClientMetadata?: null|array<string, string>,
152189
* AnalyticsMetadata?: null|AnalyticsMetadataType|array,
153190
* ContextData?: null|ContextDataType|array,
191+
* Session?: null|string,
154192
* '@region'?: string|null,
155193
* } $input
156194
*/
@@ -163,6 +201,7 @@ public function __construct(array $input = [])
163201
$this->clientMetadata = $input['ClientMetadata'] ?? null;
164202
$this->analyticsMetadata = isset($input['AnalyticsMetadata']) ? AnalyticsMetadataType::create($input['AnalyticsMetadata']) : null;
165203
$this->contextData = isset($input['ContextData']) ? ContextDataType::create($input['ContextData']) : null;
204+
$this->session = $input['Session'] ?? null;
166205
parent::__construct($input);
167206
}
168207

@@ -175,6 +214,7 @@ public function __construct(array $input = [])
175214
* ClientMetadata?: null|array<string, string>,
176215
* AnalyticsMetadata?: null|AnalyticsMetadataType|array,
177216
* ContextData?: null|ContextDataType|array,
217+
* Session?: null|string,
178218
* '@region'?: string|null,
179219
* }|AdminInitiateAuthRequest $input
180220
*/
@@ -222,6 +262,11 @@ public function getContextData(): ?ContextDataType
222262
return $this->contextData;
223263
}
224264

265+
public function getSession(): ?string
266+
{
267+
return $this->session;
268+
}
269+
225270
public function getUserPoolId(): ?string
226271
{
227272
return $this->userPoolId;
@@ -304,6 +349,13 @@ public function setContextData(?ContextDataType $value): self
304349
return $this;
305350
}
306351

352+
public function setSession(?string $value): self
353+
{
354+
$this->session = $value;
355+
356+
return $this;
357+
}
358+
307359
public function setUserPoolId(?string $value): self
308360
{
309361
$this->userPoolId = $value;
@@ -355,6 +407,9 @@ private function requestBody(): array
355407
if (null !== $v = $this->contextData) {
356408
$payload['ContextData'] = $v->requestBody();
357409
}
410+
if (null !== $v = $this->session) {
411+
$payload['Session'] = $v;
412+
}
358413

359414
return $payload;
360415
}

0 commit comments

Comments
 (0)