public class CognitoUserPool extends Object
A user-pool can have these:
1) User pool ID, userPoolId
. This is an unique identifier for your user pool. This is
a required parameter to use the SDK.
2) Client identifier, clientId
. This is generated for a user pool and each user pool
can have several of these. A client identifier will associated with one, and only one, user
pool. This is required to use the SDK. A client identifier can have one or no client secrets.
3) Client secret, clientSecret
. This is generated for a Client identified. A client
identifier may have a client secret, it is not necessary to generate a client secret for all
client identifiers. However if a client identifier has a client secret then this client secret
has to be used, along with the client identifier, in the SDK.
CognitoUser
.Constructor and Description |
---|
CognitoUserPool(android.content.Context context,
String userPoolId,
String clientId,
String clientSecret)
Deprecated.
use
CognitoUserPool(Context, String, String, String, ClientConfiguration, Regions)
Constructs a user-pool with default |
CognitoUserPool(android.content.Context context,
String userPoolId,
String clientId,
String clientSecret,
AmazonCognitoIdentityProvider client)
Constructs a user-pool with default
ClientConfiguration . |
CognitoUserPool(android.content.Context context,
String userPoolId,
String clientId,
String clientSecret,
ClientConfiguration clientConfiguration)
Deprecated.
use
CognitoUserPool(Context, String, String, String, ClientConfiguration, Regions)
Constructs a user-pool with a developer specified |
CognitoUserPool(android.content.Context context,
String userPoolId,
String clientId,
String clientSecret,
ClientConfiguration clientConfiguration,
Regions region)
Constructs a user-pool.
|
CognitoUserPool(android.content.Context context,
String userPoolId,
String clientId,
String clientSecret,
Regions region)
Constructs a user-pool with default
ClientConfiguration . |
Modifier and Type | Method and Description |
---|---|
String |
getClientId()
Returns Client ID set for this pool.
|
CognitoUser |
getCurrentUser()
Returns last authenticated user on this device in this user pool.
|
CognitoUser |
getUser()
Returns a
CognitoUser with no username set. |
CognitoUser |
getUser(String userId)
Returns a CognitoUser with userId
userId |
String |
getUserPoolId()
Returns Pool ID of this pool.
|
void |
signUp(String userId,
String password,
CognitoUserAttributes userAttributes,
Map<String,String> validationData,
SignUpHandler callback)
Runs user registration in current thread.
|
void |
signUpInBackground(String userId,
String password,
CognitoUserAttributes userAttributes,
Map<String,String> validationData,
SignUpHandler callback)
Runs user registration in background.
|
@Deprecated public CognitoUserPool(android.content.Context context, String userPoolId, String clientId, String clientSecret, ClientConfiguration clientConfiguration)
CognitoUserPool(Context, String, String, String, ClientConfiguration, Regions)
Constructs a user-pool with a developer specified ClientConfiguration
and default AWS region Regions
.
Region defaults to US-EAST-1.
context
- REQUIRED: Android application contextuserPoolId
- REQUIRED: User-pool-Id of the user-poolclientId
- REQUIRED: Client-Id generated for this app and user-pool at the
Cognito Identity Provider developer consoleclientSecret
- REQUIRED: Client Secret generated for this app and user-pool at
the Cognito Identity Provider developer consoleclientConfiguration
- REQUIRED: The client configuration options controlling how this
client connects to Cognito Identity Provider Service (e.g. proxy settings,
retry counts, etc.).@Deprecated public CognitoUserPool(android.content.Context context, String userPoolId, String clientId, String clientSecret)
CognitoUserPool(Context, String, String, String, ClientConfiguration, Regions)
Constructs a user-pool with default ClientConfiguration
and default AWS region Regions
.
Region defaults to US-EAST-1.
context
- REQUIRED: Android application context.userPoolId
- REQUIRED: User-pool-Id of the user-pool.clientId
- REQUIRED: Client-Id generated for this app and user-pool at the
Cognito Identity Provider developer console.clientSecret
- REQUIRED: Client Secret generated for this app and user-pool at
the Cognito Identity Provider developer console.public CognitoUserPool(android.content.Context context, String userPoolId, String clientId, String clientSecret, Regions region)
ClientConfiguration
.context
- REQUIRED: Android application context.userPoolId
- REQUIRED: User-pool-Id of the user-pool.clientId
- REQUIRED: Client-Id generated for this app and user-pool at the
Cognito Identity Provider developer console.clientSecret
- REQUIRED: Client Secret generated for this app and user-pool at
the Cognito Identity Provider developer console.region
- REQUIRED: AWS region Regions
.public CognitoUserPool(android.content.Context context, String userPoolId, String clientId, String clientSecret, ClientConfiguration clientConfiguration, Regions region)
context
- REQUIRED: Android application context.userPoolId
- REQUIRED: User-pool-Id of the user-pool.clientId
- REQUIRED: Client-Id generated for this app and user-pool at the
Cognito Identity Provider developer console.clientSecret
- REQUIRED: Client Secret generated for this app and user-pool at
the Cognito Identity Provider developer console.clientConfiguration
- REQUIRED: The client configuration options controlling how this
client connects to Cognito Identity Provider Service (e.g. proxy settings,
retry counts, etc.).region
- REQUIRED: AWS region Regions
.public CognitoUserPool(android.content.Context context, String userPoolId, String clientId, String clientSecret, AmazonCognitoIdentityProvider client)
ClientConfiguration
.context
- REQUIRED: Android application context.userPoolId
- REQUIRED: User-pool-Id of the user-pool.clientId
- REQUIRED: Client-Id generated for this app and user-pool at the
Cognito Identity Provider developer console.clientSecret
- REQUIRED: Client Secret generated for this app and user-pool at
the Cognito Identity Provider developer console.client
- REQUIRED: AWS low-level Cognito Identity Provider Client.public String getClientId()
public String getUserPoolId()
public void signUpInBackground(String userId, String password, CognitoUserAttributes userAttributes, Map<String,String> validationData, SignUpHandler callback)
userId
- REQUIRED: userId for this userpassword
- REQUIRED: Password for this useruserAttributes
- REQUIRED: Contains all attributes for this uservalidationData
- REQUIRED: Parameters for lambda function for user registrationcallback
- REQUIRED: callback, must not be nullpublic void signUp(String userId, String password, CognitoUserAttributes userAttributes, Map<String,String> validationData, SignUpHandler callback)
Note: This method will perform network operations. Calling this method in applications' main thread will cause Android to throw NetworkOnMainThreadException.
userId
- REQUIRED: userId for this userpassword
- REQUIRED: Password for this useruserAttributes
- REQUIRED: Contains all attributes for this uservalidationData
- REQUIRED: Parameters for lambda function for user registrationcallback
- REQUIRED: callback, must not be nullpublic CognitoUser getCurrentUser()
CognitoUser
for last authenticated, cached on this devicepublic CognitoUser getUser()
CognitoUser
with no username set.CognitoUser
.public CognitoUser getUser(String userId)
userId
This CognitoUser is not authenticated. Call CognitoUser.getSession(AuthenticationHandler)
to get valid tokens CognitoUserSession
userId
- Can be nulluserId
Copyright © 2017. All rights reserved.