public class CognitoUser
extends java.lang.Object
This class encapsulates all operations possible on a user and all tokens
belonging to the user. The user tokens, as CognitoUserSession
, are
stored in SharedPreferences. Only the tokens belonging to the last
successfully authenticated user are stored.
Modifier and Type | Method and Description |
---|---|
void |
associateSoftwareToken(java.lang.String sessionToken,
RegisterMfaHandler callback)
Registers an MFA based on Time-based One-time Password, run on current thread.
|
void |
associateSoftwareTokenInBackground(java.lang.String sessionToken,
RegisterMfaHandler callback)
Registers an MFA based on Time-based One-time Password.
|
void |
changePassword(java.lang.String oldUserPassword,
java.lang.String newUserPassword,
GenericHandler callback)
Request to change password for this user, in current thread.
|
void |
changePasswordInBackground(java.lang.String oldUserPassword,
java.lang.String newUserPassword,
GenericHandler callback)
Request to change password for this user, in background.
|
void |
confirmPassword(java.lang.String verificationCode,
java.lang.String newPassword,
ForgotPasswordHandler callback)
Sends the new password and the verification code to Cognito Identity
Provider service, in background.
|
void |
confirmPassword(java.lang.String verificationCode,
java.lang.String newPassword,
java.util.Map<java.lang.String,java.lang.String> clientMetadata,
ForgotPasswordHandler callback)
Sends the new password and the verification code to Cognito Identity
Provider service, in background.
|
void |
confirmPasswordInBackground(java.lang.String verificationCode,
java.lang.String newPassword,
ForgotPasswordHandler callback)
Set new password and send verification code to Cognito Identity Provider
service, in background.
|
void |
confirmPasswordInBackground(java.lang.String verificationCode,
java.lang.String newPassword,
java.util.Map<java.lang.String,java.lang.String> clientMetadata,
ForgotPasswordHandler callback)
Set new password and send verification code to Cognito Identity Provider
service, in background.
|
void |
confirmSignUp(java.lang.String confirmationCode,
boolean forcedAliasCreation,
GenericHandler callback)
Confirms user registration in current thread.
|
void |
confirmSignUp(java.lang.String confirmationCode,
boolean forcedAliasCreation,
java.util.Map<java.lang.String,java.lang.String> clientMetadata,
GenericHandler callback)
Confirms user registration in current thread.
|
void |
confirmSignUpInBackground(java.lang.String confirmationCode,
boolean forcedAliasCreation,
GenericHandler callback)
Confirms user registration in background.
|
void |
confirmSignUpInBackground(java.lang.String confirmationCode,
boolean forcedAliasCreation,
java.util.Map<java.lang.String,java.lang.String> clientMetadata,
GenericHandler callback)
Confirms user registration in background.
|
void |
deleteAttributes(java.util.List<java.lang.String> attributeNamesToDelete,
GenericHandler callback)
Deletes user attributes, in current thread.
|
void |
deleteAttributesInBackground(java.util.List<java.lang.String> attributeNamesToDelete,
GenericHandler callback)
Deletes user attributes, in background.
|
void |
deleteUser(GenericHandler callback)
Deletes this user, in current thread.
|
void |
deleteUserInBackground(GenericHandler callback)
Deletes this user, in background.
|
com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeRequest |
deviceSrpAuthRequest(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeResult challenge,
java.lang.String deviceSecret,
java.lang.String deviceGroupKey,
com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.AuthenticationHelper authenticationHelper)
Creates request for device SRP verification.
|
void |
forgotPassword(ForgotPasswordHandler callback)
Starts the process to set a new new password for forgotten password case,
in current thread.
|
void |
forgotPassword(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
ForgotPasswordHandler callback)
Starts the process to set a new new password for forgotten password case,
in current thread.
|
void |
forgotPasswordInBackground(ForgotPasswordHandler callback)
Starts the process to set a new password for forgotten password case, in
background.
|
void |
forgotPasswordInBackground(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
ForgotPasswordHandler callback)
Starts the process to set a new password for forgotten password case, in
background.
|
void |
getAttributeVerificationCode(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
java.lang.String attributeName,
VerificationHandler callback)
Requests code to verify a user attribute, in current thread.
|
void |
getAttributeVerificationCode(java.lang.String attributeName,
VerificationHandler callback)
Requests code to verify a user attribute, in current thread.
|
void |
getAttributeVerificationCodeInBackground(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
java.lang.String attributeName,
VerificationHandler callback)
Requests code to verify a user attribute, in background.
|
void |
getAttributeVerificationCodeInBackground(java.lang.String attributeName,
VerificationHandler callback)
Requests code to verify a user attribute, in background.
|
void |
getDetails(GetDetailsHandler callback)
Retrieves the current user attributes.
|
void |
getDetailsInBackground(GetDetailsHandler callback)
Retrieves the current user attributes.
|
void |
getSession(AuthenticationHandler callback)
getSession orchestrates the SignIn flow with Amazon Cognito UserPools.
|
void |
getSession(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
AuthenticationHandler callback)
getSession orchestrates the SignIn flow with Amazon Cognito UserPools.
|
void |
getSessionInBackground(AuthenticationHandler callback)
getSession orchestrates the SignIn flow with Amazon Cognito UserPools.
|
java.lang.String |
getUserId()
Returns the userId of this user.
|
java.lang.String |
getUserPoolId()
Returns the pool Id of this user.
|
void |
globalSignOut(GenericHandler callback)
Sign-out from all devices associated with this user, in current thread.
|
void |
globalSignOutInBackground(GenericHandler callback)
Sign-out from all devices associated with this user, in background.
|
java.lang.Runnable |
initiateUserAuthentication(AuthenticationDetails authenticationDetails,
AuthenticationHandler callback,
boolean runInBackground)
Note: Please use
getSession(Map, AuthenticationHandler) or
getSessionInBackground(AuthenticationHandler) instead. |
java.lang.Runnable |
initiateUserAuthentication(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
AuthenticationDetails authenticationDetails,
AuthenticationHandler callback,
boolean runInBackground)
Note: Please use
getSession(Map, AuthenticationHandler) or
getSessionInBackground(AuthenticationHandler) instead. |
void |
listDevices(int limit,
java.lang.String paginationToken,
DevicesHandler callback)
Fetches the list of all remembered devices for this user, runs in current
thread.
|
void |
listDevicesInBackground(int limit,
java.lang.String paginationToken,
DevicesHandler callback)
Fetches the list of all remembered devices for this user.
|
void |
resendConfirmationCode(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
VerificationHandler callback)
Request to resend registration confirmation code for a user, in current
thread.
|
void |
resendConfirmationCode(VerificationHandler callback)
Request to resend registration confirmation code for a user, in current
thread.
|
void |
resendConfirmationCodeInBackground(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
VerificationHandler callback)
Request to resend registration confirmation code for a user, in
background.
|
void |
resendConfirmationCodeInBackground(VerificationHandler callback)
Request to resend registration confirmation code for a user, in
background.
|
java.lang.Runnable |
respondToChallenge(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeRequest challengeResponse,
AuthenticationHandler callback,
boolean runInBackground)
This method sends the challenge response to the Cognito IDP service.
|
java.lang.Runnable |
respondToChallenge(com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeRequest challengeResponse,
AuthenticationHandler callback,
boolean runInBackground)
This method sends the challenge response to the Cognito IDP service.
|
java.lang.Runnable |
respondToMfaChallenge(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
java.lang.String mfaCode,
com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeResult challenge,
AuthenticationHandler callback,
boolean runInBackground)
Responds to an MFA challenge.
|
java.lang.Runnable |
respondToMfaChallenge(java.lang.String mfaCode,
com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeResult challenge,
AuthenticationHandler callback,
boolean runInBackground)
Responds to an MFA challenge.
|
void |
setUserMfaSettingsInBackground(java.util.List<CognitoMfaSettings> mfaSettings,
GenericHandler callback)
Sets preferences for the registered MFA's of a user.
|
void |
setUserSettings(CognitoUserSettings cognitoUserSettings,
GenericHandler callback)
Set's user settings, in current thread.
|
void |
setUserSettingsInBackground(CognitoUserSettings cognitoUserSettings,
GenericHandler callback)
Set's user settings, in background.
|
void |
signOut()
Sign-Out this user by removing all cached tokens.
|
CognitoDevice |
thisDevice()
Returns the current device, if users in this pool can remember devices.
|
void |
updateAttributes(CognitoUserAttributes attributes,
java.util.Map<java.lang.String,java.lang.String> clientMetadata,
UpdateAttributesHandler callback)
Updates attributes for a user.
|
void |
updateAttributes(CognitoUserAttributes attributes,
UpdateAttributesHandler callback)
Updates attributes for a user.
|
void |
updateAttributesInBackground(CognitoUserAttributes attributes,
UpdateAttributesHandler callback)
Updates attributes for a user.
|
void |
updateAttributesInBackground(java.util.Map<java.lang.String,java.lang.String> clientMetadata,
CognitoUserAttributes attributes,
UpdateAttributesHandler callback)
Updates attributes for a user.
|
void |
verifyAttribute(java.lang.String attributeName,
java.lang.String verificationCode,
GenericHandler callback)
Verify an attribute with the verification code, in current thread.
|
void |
verifyAttributeInBackground(java.lang.String attributeName,
java.lang.String verificationCode,
GenericHandler callback)
Verify an attribute with the verification code, in background.
|
void |
verifySoftwareToken(java.lang.String sessionToken,
java.lang.String totpCode,
java.lang.String friendlyName,
RegisterMfaHandler callback)
Verify the Time-based One-time Password based MFA tpo complete registration, in current thread.
|
void |
verifySoftwareTokenInBackground(java.lang.String sessionToken,
java.lang.String totpCode,
java.lang.String friendlyName,
RegisterMfaHandler callback)
Verify the Time-based One-time Password based MFA tpo complete registration.
|
public java.lang.String getUserId()
public java.lang.String getUserPoolId()
public void confirmSignUpInBackground(java.lang.String confirmationCode, boolean forcedAliasCreation, GenericHandler callback)
Confirming a user is required to complete the user's registration. Any other operations on a user. are possible only after registration confirmation.
confirmationCode
- REQUIRED: Code sent to the phone-number or email
used to register the user.forcedAliasCreation
- REQUIRED: This flag indicates if the
confirmation should go-through in case of parameter
contentions.callback
- REQUIRED: This is a reference to GenericHandler
callback handler.public void confirmSignUp(java.lang.String confirmationCode, boolean forcedAliasCreation, GenericHandler callback)
Confirming a user is required to complete the user's registration. Any other operations on a user are possible only after registration confirmation. Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
confirmationCode
- REQUIRED: Code sent to the phone-number or email
used to register the userforcedAliasCreation
- REQUIRED: This flag indicates if the
confirmation should go-through in case of parameter
contentions.callback
- REQUIRED: This is a reference to GenericHandler
callback handlerpublic void confirmSignUpInBackground(java.lang.String confirmationCode, boolean forcedAliasCreation, java.util.Map<java.lang.String,java.lang.String> clientMetadata, GenericHandler callback)
Confirming a user is required to complete the user's registration. Any other operations on a user. are possible only after registration confirmation.
confirmationCode
- REQUIRED: Code sent to the phone-number or email
used to register the user.forcedAliasCreation
- REQUIRED: This flag indicates if the
confirmation should go-through in case of parameter
contentions.clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.callback
- REQUIRED: This is a reference to GenericHandler
callback handler.public void confirmSignUp(java.lang.String confirmationCode, boolean forcedAliasCreation, java.util.Map<java.lang.String,java.lang.String> clientMetadata, GenericHandler callback)
Confirming a user is required to complete the user's registration. Any other operations on a user are possible only after registration confirmation. Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
confirmationCode
- REQUIRED: Code sent to the phone-number or email
used to register the userforcedAliasCreation
- REQUIRED: This flag indicates if the
confirmation should go-through in case of parameter
contentions.clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.callback
- REQUIRED: This is a reference to GenericHandler
callback handlerpublic void resendConfirmationCodeInBackground(VerificationHandler callback)
callback
- REQUIRED: VerificationHandler
callback handler.public void resendConfirmationCodeInBackground(java.util.Map<java.lang.String,java.lang.String> clientMetadata, VerificationHandler callback)
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.callback
- REQUIRED: VerificationHandler
callback handler.public void resendConfirmationCode(VerificationHandler callback)
Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
callback
- REQUIRED: VerificationHandler
callback handler.public void resendConfirmationCode(java.util.Map<java.lang.String,java.lang.String> clientMetadata, VerificationHandler callback)
Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.callback
- REQUIRED: VerificationHandler
callback handler.public void forgotPasswordInBackground(ForgotPasswordHandler callback)
This will initiate the process to set a new password when the current
password is forgotten. The new password will be successfully set only
after the verification code, sent to the registered email or phone number
of the user, successfully verified by Cognito Identity Provider service.
This method will pass a continuation object to the callback. Use setters
in the Continuation object ForgotPasswordContinuation
to set the
new password and verification code and call continue on the continuation
object, CognitoIdentityProviderContinuation.continueTask()
.
callback
- REQUIRED: ForgotPasswordHandler
callbackpublic void forgotPassword(ForgotPasswordHandler callback)
This will initiate the process to set a new password when the current
password is forgotten. The new password will be successfully set only
after the verification code, sent to the registered email or phone number
of the user, successfully verified by Cognito Identity Provider service.
This method will pass a continuation object to the callback. Use setters
in the Continuation object ForgotPasswordContinuation
to set the
new password and verification code and call continue on the continuation
object, CognitoIdentityProviderContinuation.continueTask()
.
Note: This method will perform network operations. Calling this
method in applications' main thread will cause Android to throw
NetworkOnMainThreadException.
callback
- REQUIRED: ForgotPasswordHandler
callbackpublic void forgotPasswordInBackground(java.util.Map<java.lang.String,java.lang.String> clientMetadata, ForgotPasswordHandler callback)
This will initiate the process to set a new password when the current
password is forgotten. The new password will be successfully set only
after the verification code, sent to the registered email or phone number
of the user, successfully verified by Cognito Identity Provider service.
This method will pass a continuation object to the callback. Use setters
in the Continuation object ForgotPasswordContinuation
to set the
new password and verification code and call continue on the continuation
object, CognitoIdentityProviderContinuation.continueTask()
.
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
lambda functions triggered by forgot password.callback
- REQUIRED: ForgotPasswordHandler
callbackpublic void forgotPassword(java.util.Map<java.lang.String,java.lang.String> clientMetadata, ForgotPasswordHandler callback)
This will initiate the process to set a new password when the current
password is forgotten. The new password will be successfully set only
after the verification code, sent to the registered email or phone number
of the user, successfully verified by Cognito Identity Provider service.
This method will pass a continuation object to the callback. Use setters
in the Continuation object ForgotPasswordContinuation
to set the
new password and verification code and call continue on the continuation
object, CognitoIdentityProviderContinuation.continueTask()
.
Note: This method will perform network operations. Calling this
method in applications' main thread will cause Android to throw
NetworkOnMainThreadException.
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
lambda functions triggered by forgot password.callback
- REQUIRED: ForgotPasswordHandler
callbackpublic void confirmPasswordInBackground(java.lang.String verificationCode, java.lang.String newPassword, ForgotPasswordHandler callback)
This method will be called by ForgotPasswordContinuation
continuation object.
verificationCode
- REQUIRED: Code sent from Cognito Identity
Provider Service.newPassword
- REQUIRED: New password. On successful verification of
verificationCode
, this will be the new password for
this user.callback
- REQUIRED: ForgotPasswordHandler
callback.public void confirmPasswordInBackground(java.lang.String verificationCode, java.lang.String newPassword, java.util.Map<java.lang.String,java.lang.String> clientMetadata, ForgotPasswordHandler callback)
This method will be called by ForgotPasswordContinuation
continuation object.
verificationCode
- REQUIRED: Code sent from Cognito Identity
Provider Service.newPassword
- REQUIRED: New password. On successful verification of
verificationCode
, this will be the new password for
this user.clientMetadata
- A map of custom key-value pairs that you can provide as input for any
custom workflows triggered by confirm password.callback
- REQUIRED: ForgotPasswordHandler
callback.public void confirmPassword(java.lang.String verificationCode, java.lang.String newPassword, ForgotPasswordHandler callback)
This method will be called by ForgotPasswordContinuation
continuation object. Note: This method will perform network
operations. Calling this method in applications' main thread will cause
Android to throw NetworkOnMainThreadException.
verificationCode
- REQUIRED: Code sent from Cognito Identity
Provider Service.newPassword
- REQUIRED: New password. On successful verification of
verificationCode
, this will be the new password for
this user.callback
- REQUIRED: ForgotPasswordHandler
callback.public void confirmPassword(java.lang.String verificationCode, java.lang.String newPassword, java.util.Map<java.lang.String,java.lang.String> clientMetadata, ForgotPasswordHandler callback)
This method will be called by ForgotPasswordContinuation
continuation object. Note: This method will perform network
operations. Calling this method in applications' main thread will cause
Android to throw NetworkOnMainThreadException.
verificationCode
- REQUIRED: Code sent from Cognito Identity
Provider Service.newPassword
- REQUIRED: New password. On successful verification of
verificationCode
, this will be the new password for
this user.clientMetadata
- A map of custom key-value pairs that you can provide as input for any
custom workflows triggered by confirm password.callback
- REQUIRED: ForgotPasswordHandler
callback.public void getSessionInBackground(AuthenticationHandler callback)
This method is asynchronous and performs network operations on a background thread.
1) Read the tokens (Id, Access and Refresh) that are cached on the device.
1.1) If the Id and Access tokens are present and they are valid, the
AuthenticationHandler.onSuccess(CognitoUserSession, CognitoDevice)
.
will be called with a CognitoUserSession
that has references to the valid tokens.
This means that the user is signed-in.
1.2) If the Id and Access tokens are expired, and if there is a valid refresh token,
a network call is made to get new Id and Access tokens.
If valid Id and Access tokens are retrieved, they are cached on the device
and AuthenticationHandler.onSuccess(CognitoUserSession, CognitoDevice)
will be called with a CognitoUserSession
that has references to the valid
tokens. This means that the user is signed-in.
2) If there are no valid tokens cached on the device, the callback method
AuthenticationHandler.getAuthenticationDetails(AuthenticationContinuation, String)
will be called where the AuthenticationDetails
will need to be supplied
to continue the SignIn operation. See
CognitoIdentityProviderContinuation
for details on continuation objects.
3) In all other error scenarios, AuthenticationHandler.onFailure(Exception)
will
be called with the type and message of the exception and it is the responsibility of
the caller to handle the exceptions appropriately.
callback
- REQUIRED: AuthenticationHandler
callbackpublic void getSession(AuthenticationHandler callback)
This method is synchronous and performs network operations on the same thread in which the method is called. Calling this method in the MainThread will result in NetworkOnMainThreadException
1) Read the tokens (Id, Access and Refresh) that are cached on the device.
1.1) If the Id and Access tokens are present and they are valid, the
AuthenticationHandler.onSuccess(CognitoUserSession, CognitoDevice)
.
will be called with a CognitoUserSession
that has references to the valid tokens.
This means that the user is signed-in.
1.2) If the Id and Access tokens are expired, and if there is a valid refresh token,
a network call is made to get new Id and Access tokens.
If valid Id and Access tokens are retrieved, they are cached on the device
and AuthenticationHandler.onSuccess(CognitoUserSession, CognitoDevice)
will be called with a CognitoUserSession
that has references to the valid
tokens. This means that the user is signed-in.
2) If there are no valid tokens cached on the device, the callback method
AuthenticationHandler.getAuthenticationDetails(AuthenticationContinuation, String)
will be called where the AuthenticationDetails
will need to be supplied
to continue the SignIn operation. See
CognitoIdentityProviderContinuation
for details on continuation objects.
3) In all other error scenarios, AuthenticationHandler.onFailure(Exception)
will
be called with the type and message of the exception and it is the responsibility of
the caller to handle the exceptions appropriately.
callback
- REQUIRED: AuthenticationHandler
callbackpublic void getSession(java.util.Map<java.lang.String,java.lang.String> clientMetadata, AuthenticationHandler callback)
This method is synchronous and performs network operations on the same thread in which the method is called. Calling this method in the MainThread will result in NetworkOnMainThreadException
1) Read the tokens (Id, Access and Refresh) that are cached on the device.
1.1) If the Id and Access tokens are present and they are valid, the
AuthenticationHandler.onSuccess(CognitoUserSession, CognitoDevice)
.
will be called with a CognitoUserSession
that has references to the valid tokens.
This means that the user is signed-in.
1.2) If the Id and Access tokens are expired, and if there is a valid refresh token,
a network call is made to get new Id and Access tokens.
If valid Id and Access tokens are retrieved, they are cached on the device
and AuthenticationHandler.onSuccess(CognitoUserSession, CognitoDevice)
will be called with a CognitoUserSession
that has references to the valid
tokens. This means that the user is signed-in.
2) If there are no valid tokens cached on the device, the callback method
AuthenticationHandler.getAuthenticationDetails(AuthenticationContinuation, String)
will be called where the AuthenticationDetails
will need to be supplied
to continue the SignIn operation. See
CognitoIdentityProviderContinuation
for details on continuation objects.
3) In all other error scenarios, AuthenticationHandler.onFailure(Exception)
will
be called with the type and message of the exception and it is the responsibility of
the caller to handle the exceptions appropriately.
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.callback
- REQUIRED: AuthenticationHandler
callbackpublic java.lang.Runnable initiateUserAuthentication(AuthenticationDetails authenticationDetails, AuthenticationHandler callback, boolean runInBackground)
getSession(Map, AuthenticationHandler)
or
getSessionInBackground(AuthenticationHandler)
instead.
Initiates user authentication through the generic auth flow (also called
as Enhanced or Custom authentication). This is the first step in user
authentication. The response to this step from the service will contain
information about the next step in the authentication process.authenticationDetails
- REQUIRED: Contains details about the user
authentication.runInBackground
- flag indicating if the operation has to run in
backgroundcallback
- REQUIRED: AuthenticationHandler
callback.Runnable
for the next step in user authentication.public java.lang.Runnable initiateUserAuthentication(java.util.Map<java.lang.String,java.lang.String> clientMetadata, AuthenticationDetails authenticationDetails, AuthenticationHandler callback, boolean runInBackground)
getSession(Map, AuthenticationHandler)
or
getSessionInBackground(AuthenticationHandler)
instead.
Initiates user authentication through the generic auth flow (also called
as Enhanced or Custom authentication). This is the first step in user
authentication. The response to this step from the service will contain
information about the next step in the authentication process.clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.authenticationDetails
- REQUIRED: Contains details about the user
authentication.runInBackground
- flag indicating if the operation has to run in
backgroundcallback
- REQUIRED: AuthenticationHandler
callback.Runnable
for the next step in user authentication.public java.lang.Runnable respondToMfaChallenge(java.lang.String mfaCode, com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeResult challenge, AuthenticationHandler callback, boolean runInBackground)
mfaCode
- REQUIRED: The MFA code received by the user.challenge
- REQUIRED: Current challenge
RespondToAuthChallengeResult
.runInBackground
- flag indicating if the operation has to run in
background.callback
- REQUIRED: AuthenticationHandler
callback.Runnable
for the next step in user authentication.public java.lang.Runnable respondToMfaChallenge(java.util.Map<java.lang.String,java.lang.String> clientMetadata, java.lang.String mfaCode, com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeResult challenge, AuthenticationHandler callback, boolean runInBackground)
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.mfaCode
- REQUIRED: The MFA code received by the user.challenge
- REQUIRED: Current challenge
RespondToAuthChallengeResult
.runInBackground
- flag indicating if the operation has to run in
background.callback
- REQUIRED: AuthenticationHandler
callback.Runnable
for the next step in user authentication.public void changePasswordInBackground(java.lang.String oldUserPassword, java.lang.String newUserPassword, GenericHandler callback)
This operation requires a valid accessToken. Un-authenticated users will have to be authenticated before calling this method.
oldUserPassword
- REQUIRED: Current password of this user.newUserPassword
- REQUIRED: New password for this user.callback
- REQUIRED: GenericHandler
callback handler.public void changePassword(java.lang.String oldUserPassword, java.lang.String newUserPassword, GenericHandler callback)
This operation requires a valid accessToken. Unauthenticated users will need to be authenticated before calling this method. Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
oldUserPassword
- REQUIRED: Current password of this user.newUserPassword
- REQUIRED: New password for this user.callback
- REQUIRED: GenericHandler
callback handler.public void getDetailsInBackground(GetDetailsHandler callback)
All attributes, which are set for this user, are fetched. This method requires valid accessToken.
callback
- REQUIRED: GetDetailsHandler
callbackpublic void getDetails(GetDetailsHandler callback)
All attributes, which are set for this user, are fetched. This method requires valid accessToken. Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
callback
- REQUIRED: GetDetailsHandler
callbackpublic void getAttributeVerificationCodeInBackground(java.lang.String attributeName, VerificationHandler callback)
The user attributes that can be verified are those attributes that can be used to communicate with the user, e.g. phone_number and email. The verification code is sent to the medium that is represented by the attribute. Attribute verification is required to enable the attribute to be used an attribute as alias for the user. Aliases attributes can be used in lieu of the userId to authenticate the user. If an attribute was used in the confirm the user after sign-up, then that alias is already verified and does not require re-verification.
attributeName
- REQUIRED: Name of the attribute that requires
verification.callback
- REQUIRED: callback.public void getAttributeVerificationCodeInBackground(java.util.Map<java.lang.String,java.lang.String> clientMetadata, java.lang.String attributeName, VerificationHandler callback)
The user attributes that can be verified are those attributes that can be used to communicate with the user, e.g. phone_number and email. The verification code is sent to the medium that is represented by the attribute. Attribute verification is required to enable the attribute to be used an attribute as alias for the user. Aliases attributes can be used in lieu of the userId to authenticate the user. If an attribute was used in the confirm the user after sign-up, then that alias is already verified and does not require re-verification.
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
lambda functions triggered by forgot password.attributeName
- REQUIRED: Name of the attribute that requires
verification.callback
- REQUIRED: callback.public void getAttributeVerificationCode(java.lang.String attributeName, VerificationHandler callback)
The user attributes that can be verified are those attributes that can be used to communicate with the user, e.g. phone_number and email. The verification code is sent to the medium that is represented by the attribute. Attribute verification is required to enable the attribute to be used an attribute as alias for the user. Aliases attributes can be used in lieu of the userId to authenticate the user. If an attribute was used in the confirm the user after sign-up, then that alias is already verified and does not require re-verification. Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
attributeName
- REQUIRED: Name of the attribute that requires
verification.callback
- REQUIRED: callback.public void getAttributeVerificationCode(java.util.Map<java.lang.String,java.lang.String> clientMetadata, java.lang.String attributeName, VerificationHandler callback)
The user attributes that can be verified are those attributes that can be used to communicate with the user, e.g. phone_number and email. The verification code is sent to the medium that is represented by the attribute. Attribute verification is required to enable the attribute to be used an attribute as alias for the user. Aliases attributes can be used in lieu of the userId to authenticate the user. If an attribute was used in the confirm the user after sign-up, then that alias is already verified and does not require re-verification. Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
lambda functions triggered by forgot password.attributeName
- REQUIRED: Name of the attribute that requires
verification.callback
- REQUIRED: callback.public void verifyAttributeInBackground(java.lang.String attributeName, java.lang.String verificationCode, GenericHandler callback)
Call this method to verify an attribute with the "verification code". To
request for a "verification code" call the method
getAttributeVerificationCodeInBackground(String, VerificationHandler)
.
attributeName
- REQUIRED: The attribute that is being verified.verificationCode
- REQUIRED: The code for verification.callback
- REQUIRED: Callbackpublic void verifyAttribute(java.lang.String attributeName, java.lang.String verificationCode, GenericHandler callback)
Call this method to verify an attribute with the "verification code". To
request for a "verification code" call the method
getAttributeVerificationCodeInBackground(String, VerificationHandler)
. Note: This method will perform network operations. Calling this
method in applications' main thread will cause Android to throw
NetworkOnMainThreadException.
attributeName
- REQUIRED: The attribute that is being verified.verificationCode
- REQUIRED: The code for verification.callback
- REQUIRED: Callbackpublic void associateSoftwareTokenInBackground(java.lang.String sessionToken, RegisterMfaHandler callback)
sessionToken
- Optional: If a session token has to be used to register the MFA.callback
- Required: Callback handler VerifyMfaContinuation
.public void associateSoftwareToken(java.lang.String sessionToken, RegisterMfaHandler callback)
sessionToken
- Optional: If a session token has to be used to register the MFA.callback
- Required: Callback handler VerifyMfaContinuation
.public void verifySoftwareTokenInBackground(java.lang.String sessionToken, java.lang.String totpCode, java.lang.String friendlyName, RegisterMfaHandler callback)
sessionToken
- Optional: If a session token has to be used to register the MFA.totpCode
- Required: The TOTP code.friendlyName
- Required: Friendly name to be associated with this MFA.callback
- Required: Callback handler VerifyMfaContinuation
.public void verifySoftwareToken(java.lang.String sessionToken, java.lang.String totpCode, java.lang.String friendlyName, RegisterMfaHandler callback)
sessionToken
- Optional: If a session token has to be used to register the MFA.totpCode
- Required: The TOTP code.friendlyName
- Required: Friendly name to be associated with this MFA.callback
- Required: Callback handler VerifyMfaContinuation
.public void updateAttributesInBackground(CognitoUserAttributes attributes, UpdateAttributesHandler callback)
Requires valid accessToken.
attributes
- REQUIRED: All attributes and values that need to be
updated for this user.callback
- REQUIRED: UpdateAttributesHandler
callback.public void updateAttributesInBackground(java.util.Map<java.lang.String,java.lang.String> clientMetadata, CognitoUserAttributes attributes, UpdateAttributesHandler callback)
Requires valid accessToken.
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.attributes
- REQUIRED: All attributes and values that need to be
updated for this user.callback
- REQUIRED: UpdateAttributesHandler
callback.public void updateAttributes(CognitoUserAttributes attributes, UpdateAttributesHandler callback)
Requires valid accessToken. Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
attributes
- REQUIRED: All attributes and values that need to be
updated for this user.callback
- REQUIRED: UpdateAttributesHandler
callback.public void updateAttributes(CognitoUserAttributes attributes, java.util.Map<java.lang.String,java.lang.String> clientMetadata, UpdateAttributesHandler callback)
Requires valid accessToken. Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
attributes
- REQUIRED: All attributes and values that need to be
updated for this user.clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.callback
- REQUIRED: UpdateAttributesHandler
callback.public void deleteAttributesInBackground(java.util.List<java.lang.String> attributeNamesToDelete, GenericHandler callback)
attributeNamesToDelete
- REQUIRED: List of user attributes that have
to be deleted.callback
- REQUIRED: GenericHandler
callbackpublic void deleteAttributes(java.util.List<java.lang.String> attributeNamesToDelete, GenericHandler callback)
Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
attributeNamesToDelete
- REQUIRED: List of user attributes that have
to be deleted.callback
- REQUIRED: GenericHandler
callbackpublic void signOut()
public void globalSignOutInBackground(GenericHandler callback)
callback
- REQUIRED: GenericHandler
callback.public void globalSignOut(GenericHandler callback)
Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
callback
- REQUIRED: GenericHandler
callback.public void deleteUserInBackground(GenericHandler callback)
callback
- REQUIRED: @link GenericHandler} callback.public void deleteUser(GenericHandler callback)
Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
callback
- REQUIRED: @link GenericHandler} callback.public void setUserSettingsInBackground(CognitoUserSettings cognitoUserSettings, GenericHandler callback)
cognitoUserSettings
- REQUIRED: User settings as
CognitoUserSettings
.callback
- REQUIRED: GenericHandler
callback.public void setUserSettings(CognitoUserSettings cognitoUserSettings, GenericHandler callback)
Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
cognitoUserSettings
- REQUIRED: User settings as
CognitoUserSettings
.callback
- REQUIRED: GenericHandler
callback.public void setUserMfaSettingsInBackground(java.util.List<CognitoMfaSettings> mfaSettings, GenericHandler callback)
mfaSettings
- Required: A list with all MFA settings.callback
- Required: GenericHandler
callback.public java.lang.Runnable respondToChallenge(com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeRequest challengeResponse, AuthenticationHandler callback, boolean runInBackground)
challengeResponse
- REQUIRED: RespondToAuthChallengeRequest
contains response for the current challenge.callback
- REQUIRED: AuthenticationHandler
callback.runInBackground
- REQUIRED: Boolean to indicate the current
threading.Runnable
for the next step in user authentication.public java.lang.Runnable respondToChallenge(java.util.Map<java.lang.String,java.lang.String> clientMetadata, com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeRequest challengeResponse, AuthenticationHandler callback, boolean runInBackground)
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.challengeResponse
- REQUIRED: RespondToAuthChallengeRequest
contains response for the current challenge.callback
- REQUIRED: AuthenticationHandler
callback.runInBackground
- REQUIRED: Boolean to indicate the current
threading.Runnable
for the next step in user authentication.public com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeRequest deviceSrpAuthRequest(java.util.Map<java.lang.String,java.lang.String> clientMetadata, com.amazonaws.services.cognitoidentityprovider.model.RespondToAuthChallengeResult challenge, java.lang.String deviceSecret, java.lang.String deviceGroupKey, com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.AuthenticationHelper authenticationHelper)
clientMetadata
- A map of custom key-value pairs that is passed to the lambda function for
custom workflow.challenge
- REQUIRED: RespondToAuthChallengeResult
contains
next challenge.deviceSecret
- REQUIRED: Device secret verifier.authenticationHelper
- REQUIRED: Internal helper class for SRP
calculations.deviceGroupKey
- the device group keyRespondToAuthChallengeRequest
.public void listDevicesInBackground(int limit, java.lang.String paginationToken, DevicesHandler callback)
limit
- REQUIRED: Maximum number of devices to be returned in this
call, defaults to 10.paginationToken
- REQUIRED: Token to continue an earlier search.callback
- REQUIRED: DevicesHandler
callback.public void listDevices(int limit, java.lang.String paginationToken, DevicesHandler callback)
limit
- REQUIRED: Maximum number of devices to be returned in this
call, defaults to 10.paginationToken
- REQUIRED: Token to continue an earlier search.callback
- REQUIRED: DevicesHandler
callback.public CognitoDevice thisDevice()
CognitoDevice
if the device is available, null otherwise.Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.