Class UserPasswordAuthProviderClientImpl
- java.lang.Object
-
- com.mongodb.stitch.core.auth.providers.internal.CoreAuthProviderClient<StitchRequestClient>
-
- com.mongodb.stitch.core.auth.providers.userpassword.internal.CoreUserPasswordAuthProviderClient
-
- com.mongodb.stitch.android.core.auth.providers.userpassword.internal.UserPasswordAuthProviderClientImpl
-
- All Implemented Interfaces:
UserPasswordAuthProviderClient
public final class UserPasswordAuthProviderClientImpl extends CoreUserPasswordAuthProviderClient implements UserPasswordAuthProviderClient
The implementation of the User/Password authentication provider client.
-
-
Field Summary
-
Fields inherited from interface com.mongodb.stitch.android.core.auth.providers.userpassword.UserPasswordAuthProviderClient
factory
-
-
Constructor Summary
Constructors Constructor Description UserPasswordAuthProviderClientImpl(String providerName, StitchRequestClient requestClient, StitchAuthRoutes routes, TaskDispatcher dispatcher)
Constructs a new User/Password authentication provider client.
-
Method Summary
Modifier and Type Method Description Task<Void>
callResetPasswordFunction(String email, String password, List<?> args)
Call a reset password function configured to the provider.Task<Void>
confirmUser(String token, String tokenId)
Confirms a user with the given token and token id.Task<Void>
registerWithEmail(String email, String password)
Registers a new user with the given email and password.Task<Void>
resendConfirmationEmail(String email)
Resend the confirmation for a user to the given email.Task<Void>
resetPassword(String token, String tokenId, String password)
Resets the password of a user with the given token, token id, and new password.Task<Void>
sendResetPasswordEmail(String email)
Sends a user a password reset email for the given email.-
Methods inherited from class com.mongodb.stitch.core.auth.providers.userpassword.internal.CoreUserPasswordAuthProviderClient
callResetPasswordFunctionInternal, confirmUserInternal, registerWithEmailInternal, resendConfirmationEmailInternal, resetPasswordInternal, sendResetPasswordEmailInternal
-
Methods inherited from class com.mongodb.stitch.core.auth.providers.internal.CoreAuthProviderClient
getBaseRoute, getProviderName, getRequestClient
-
-
-
-
Constructor Detail
-
UserPasswordAuthProviderClientImpl
public UserPasswordAuthProviderClientImpl(String providerName, StitchRequestClient requestClient, StitchAuthRoutes routes, TaskDispatcher dispatcher)
Constructs a new User/Password authentication provider client.- Parameters:
providerName
- the provider this client is for.requestClient
- the request client used to make requests against Stitch.routes
- the routes needed by the request client.dispatcher
- the task dispatcher for async requests.
-
-
Method Detail
-
registerWithEmail
public Task<Void> registerWithEmail(@NonNull String email, @NonNull String password)
Registers a new user with the given email and password.- Specified by:
registerWithEmail
in interfaceUserPasswordAuthProviderClient
- Parameters:
email
- the email to register with. This will be the username used during log in.password
- the password to associated with the email. The password must be between 6 and 128 characters long.- Returns:
- A
Task
that completes when registration completes/fails.
-
confirmUser
public Task<Void> confirmUser(@NonNull String token, @NonNull String tokenId)
Confirms a user with the given token and token id.- Specified by:
confirmUser
in interfaceUserPasswordAuthProviderClient
- Parameters:
token
- the confirmation token.tokenId
- the id of the confirmation token.- Returns:
- A
Task
that completes when confirmation completes/fails.
-
resendConfirmationEmail
public Task<Void> resendConfirmationEmail(@NonNull String email)
Resend the confirmation for a user to the given email.- Specified by:
resendConfirmationEmail
in interfaceUserPasswordAuthProviderClient
- Parameters:
email
- the email of the user.- Returns:
- A
Task
that completes when the resend request completes/fails.
-
resetPassword
public Task<Void> resetPassword(@NonNull String token, @NonNull String tokenId, @NonNull String password)
Resets the password of a user with the given token, token id, and new password.- Specified by:
resetPassword
in interfaceUserPasswordAuthProviderClient
- Parameters:
token
- the reset password token.tokenId
- the id of the reset password token.password
- the new password for the user. The password must be between 6 and 128 characters long.- Returns:
- A
Task
that completes when the password reset completes/fails.
-
sendResetPasswordEmail
public Task<Void> sendResetPasswordEmail(@NonNull String email)
Sends a user a password reset email for the given email.- Specified by:
sendResetPasswordEmail
in interfaceUserPasswordAuthProviderClient
- Parameters:
email
- the email of the user.- Returns:
- A
Task
that completes when the reqest request completes/fails.
-
callResetPasswordFunction
public Task<Void> callResetPasswordFunction(String email, String password, List<?> args)
Description copied from interface:UserPasswordAuthProviderClient
Call a reset password function configured to the provider.- Specified by:
callResetPasswordFunction
in interfaceUserPasswordAuthProviderClient
- Parameters:
email
- the email of the userpassword
- the new password to setargs
- arguments to be provided to the reset function- Returns:
- A
Task
that completes when the reqest request completes/fails.
-
-