AWS Cognito Change User Password Programmatically in Java
Add the Amazon Cognito Java SDK dependency to your Java project.
The code shows how to change a user password programmatically in Java:
AdminSetUserPasswordRequest adminSetUserPasswordRequest =
new AdminSetUserPasswordRequest().withUsername(username)
.withUserPoolId(userPoolId).withPassword(password).withPermanent(true);
cognitoClient.adminSetUserPassword(adminSetUserPasswordRequest);