public class CognitoUserPool
extends java.lang.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,
AWSConfiguration awsConfiguration)
Constructs a user-pool with default
ClientConfiguration . |
CognitoUserPool(android.content.Context context,
java.lang.String userPoolId,
java.lang.String clientId,
java.lang.String clientSecret)
Deprecated.
use
CognitoUserPool(Context, String, String, String, ClientConfiguration, Regions)
Constructs a user-pool with default |
CognitoUserPool(android.content.Context context,
java.lang.String userPoolId,
java.lang.String clientId,
java.lang.String clientSecret,
com.amazonaws.services.cognitoidentityprovider.AmazonCognitoIdentityProvider client)
Constructs a user-pool with default
ClientConfiguration . |
CognitoUserPool(android.content.Context context,
java.lang.String userPoolId,
java.lang.String clientId,
java.lang.String clientSecret,
com.amazonaws.services.cognitoidentityprovider.AmazonCognitoIdentityProvider client,
java.lang.String pinpointAppId)
Constructs a user-pool with default
ClientConfiguration and integrated analytics. |
CognitoUserPool(android.content.Context context,
java.lang.String userPoolId,
java.lang.String clientId,
java.lang.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,
java.lang.String userPoolId,
java.lang.String clientId,
java.lang.String clientSecret,
ClientConfiguration clientConfiguration,
Regions region)
Constructs a user-pool.
|
CognitoUserPool(android.content.Context context,
java.lang.String userPoolId,
java.lang.String clientId,
java.lang.String clientSecret,
ClientConfiguration clientConfiguration,
Regions region,
java.lang.String pinpointAppId)
Constructs a user-pool with integrated Pinpoint analytics.
|
CognitoUserPool(android.content.Context context,
java.lang.String userPoolId,
java.lang.String clientId,
java.lang.String clientSecret,
Regions region)
Constructs a user-pool with default
ClientConfiguration . |
CognitoUserPool(android.content.Context context,
java.lang.String userPoolId,
java.lang.String clientId,
java.lang.String clientSecret,
Regions region,
java.lang.String pinpointAppId)
Constructs a user-pool with default
ClientConfiguration . |
Modifier and Type | Method and Description |
---|---|
java.lang.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(java.lang.String userId)
Returns a CognitoUser with userId
userId |
java.lang.String |
getUserPoolId()
Returns Pool ID of this pool.
|
void |
setAdvancedSecurityDataCollectionFlag(boolean isEnabled)
This method sets context data collection for the user.
|
void |
setPersistenceEnabled(boolean isPersistenceEnabled)
Enable or disable persistence
|
void |
signUp(java.lang.String userId,
java.lang.String password,
CognitoUserAttributes userAttributes,
java.util.Map<java.lang.String,java.lang.String> validationData,
java.util.Map<java.lang.String,java.lang.String> clientMetadata,
SignUpHandler callback)
Runs user registration in current thread.
|
void |
signUp(java.lang.String userId,
java.lang.String password,
CognitoUserAttributes userAttributes,
java.util.Map<java.lang.String,java.lang.String> validationData,
SignUpHandler callback)
Runs user registration in current thread.
|
void |
signUpInBackground(java.lang.String userId,
java.lang.String password,
CognitoUserAttributes userAttributes,
java.util.Map<java.lang.String,java.lang.String> validationData,
java.util.Map<java.lang.String,java.lang.String> clientMetadata,
SignUpHandler callback)
Runs user registration in background.
|
void |
signUpInBackground(java.lang.String userId,
java.lang.String password,
CognitoUserAttributes userAttributes,
java.util.Map<java.lang.String,java.lang.String> validationData,
SignUpHandler callback)
Runs user registration in background.
|
@Deprecated public CognitoUserPool(android.content.Context context, java.lang.String userPoolId, java.lang.String clientId, java.lang.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, java.lang.String userPoolId, java.lang.String clientId, java.lang.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, AWSConfiguration awsConfiguration)
ClientConfiguration
.context
- REQUIRED: Android application context.awsConfiguration
- REQUIRED: Holds the configuration read from awsconfiguration.jsonpublic CognitoUserPool(android.content.Context context, java.lang.String userPoolId, java.lang.String clientId, java.lang.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, java.lang.String userPoolId, java.lang.String clientId, java.lang.String clientSecret, Regions region, java.lang.String pinpointAppId)
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
.pinpointAppId
- REQUIRED: AWS Pinpoint App Id for analytics.public CognitoUserPool(android.content.Context context, java.lang.String userPoolId, java.lang.String clientId, java.lang.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, java.lang.String userPoolId, java.lang.String clientId, java.lang.String clientSecret, ClientConfiguration clientConfiguration, Regions region, java.lang.String pinpointAppId)
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
.pinpointAppId
- REQUIRED: AWS Pinpoint App Id for analytics.public CognitoUserPool(android.content.Context context, java.lang.String userPoolId, java.lang.String clientId, java.lang.String clientSecret, com.amazonaws.services.cognitoidentityprovider.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 CognitoUserPool(android.content.Context context, java.lang.String userPoolId, java.lang.String clientId, java.lang.String clientSecret, com.amazonaws.services.cognitoidentityprovider.AmazonCognitoIdentityProvider client, java.lang.String pinpointAppId)
ClientConfiguration
and integrated analytics.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.pinpointAppId
- REQUIRED: AWS Pinpoint App Id for analytics.public java.lang.String getClientId()
public java.lang.String getUserPoolId()
public void setAdvancedSecurityDataCollectionFlag(boolean isEnabled)
isEnabled
- if the data collection is enabled.public void setPersistenceEnabled(boolean isPersistenceEnabled)
isPersistenceEnabled
- flag if true indicates tokens are persisted.public void signUpInBackground(java.lang.String userId, java.lang.String password, CognitoUserAttributes userAttributes, java.util.Map<java.lang.String,java.lang.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(java.lang.String userId, java.lang.String password, CognitoUserAttributes userAttributes, java.util.Map<java.lang.String,java.lang.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 void signUpInBackground(java.lang.String userId, java.lang.String password, CognitoUserAttributes userAttributes, java.util.Map<java.lang.String,java.lang.String> validationData, java.util.Map<java.lang.String,java.lang.String> clientMetadata, 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 registrationclientMetadata
- Client metadata for lambda function for user registrationcallback
- REQUIRED: callback, must not be nullpublic void signUp(java.lang.String userId, java.lang.String password, CognitoUserAttributes userAttributes, java.util.Map<java.lang.String,java.lang.String> validationData, java.util.Map<java.lang.String,java.lang.String> clientMetadata, 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 registrationclientMetadata
- Client metadata 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(java.lang.String userId)
userId
This CognitoUser is not authenticated. Call CognitoUser.getSession(AuthenticationHandler)
to get valid tokens CognitoUserSession
userId
- Can be nulluserId
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.