AWS code-library documentation change
Summary
Added Swift SDK example for AdminGetUser API
Security assessment
Added documentation for user management API, which relates to security features but doesn't address a specific vulnerability.
Diff
diff --git a/code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_AdminGetUser_section.md b/code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_AdminGetUser_section.md index 6e4348569..39591c0f9 100644 --- a//code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_AdminGetUser_section.md +++ b//code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_AdminGetUser_section.md @@ -331,0 +332,51 @@ 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 + + /// Get information about a specific user in a user pool. + /// + /// - Parameters: + /// - cipClient: The Amazon Cognito Identity Provider client to use. + /// - userName: The user to retrieve information about. + /// - userPoolId: The user pool to search for the specified user. + /// + /// - Returns: `true` if the user's information was successfully + /// retrieved. Otherwise returns `false`. + func adminGetUser(cipClient: CognitoIdentityProviderClient, userName: String, + userPoolId: String) async -> Bool { + do { + let output = try await cipClient.adminGetUser( + input: AdminGetUserInput( + userPoolId: userPoolId, + username: userName + ) + ) + + guard let userStatus = output.userStatus else { + print("*** Unable to get the user's status.") + return false + } + + print("User status: \(userStatus)") + return true + } catch { + return false + } + } + + + + * For API details, see [AdminGetUser](https://sdk.amazonaws.com/swift/api/awscognitoidentityprovider/latest/documentation/awscognitoidentityprovider/cognitoidentityproviderclient/admingetuser\(input:\)) in _AWS SDK for Swift API reference_. + + + +