AWS cognito documentation change
Summary
Added Swift SDK code example for ConfirmSignUp API to demonstrate user confirmation workflow
Security assessment
The change documents account verification processes which help prevent unauthorized account creation. However, this is a standard security feature implementation guide rather than addressing a specific vulnerability.
Diff
diff --git a/cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ConfirmSignUp_section.md b/cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ConfirmSignUp_section.md index 0972bcfb3..4125c5cde 100644 --- a//cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ConfirmSignUp_section.md +++ b//cognito/latest/developerguide/cognito-identity-provider_example_cognito-identity-provider_ConfirmSignUp_section.md @@ -290,0 +291,50 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +Swift + + +**SDK for Swift** + + +###### Note + +There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/swift/example_code/cognito-identity-provider#code-examples). + + + import AWSCognitoIdentityProvider + + /// Submit a confirmation code for the specified user. This is the code as + /// entered by the user after they've received it by email or text + /// message. + /// + /// - Parameters: + /// - cipClient: The `CognitoIdentityProviderClient` to use. + /// - clientId: The app client ID the user is signing up for. + /// - userName: The username of the user whose code is being sent. + /// - code: The user's confirmation code. + /// + /// - Returns: `true` if the code was successfully confirmed; otherwise `false`. + func confirmSignUp(cipClient: CognitoIdentityProviderClient, clientId: String, + userName: String, code: String) async -> Bool { + do { + _ = try await cipClient.confirmSignUp( + input: ConfirmSignUpInput( + clientId: clientId, + confirmationCode: code, + username: userName + ) + ) + + print("=====> \(userName) has been confirmed.") + return true + } catch { + print("=====> \(userName)'s code was entered incorrectly.") + return false + } + } + + + + * For API details, see [ConfirmSignUp](https://sdk.amazonaws.com/swift/api/awscognitoidentityprovider/latest/documentation/awscognitoidentityprovider/cognitoidentityproviderclient/confirmsignup\(input:\)) in _AWS SDK for Swift API reference_. + + + +