|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectcom.amazonaws.auth.CognitoCredentialsProvider
public class CognitoCredentialsProvider
AWSCredentialsProvider implementation that uses the Amazon Cognito Identity service and AWS Security Token Service to create temporary, short-lived sessions to use for authentication
| Field Summary | |
|---|---|
static int |
DEFAULT_DURATION_SECONDS
Default duration for started sessions |
static int |
DEFAULT_THRESHOLD_SECONDS
Default threshold for refreshing session credentials |
| Constructor Summary | |
|---|---|
CognitoCredentialsProvider(AWSCognitoIdentityProvider provider,
java.lang.String unauthArn,
java.lang.String authArn)
Constructs a new CognitoCredentialsProvider, which will set up a link to the provider passed in, using that to get short-lived credentials from STS, which can be retrieved from getCredentials() |
|
CognitoCredentialsProvider(AWSCognitoIdentityProvider provider,
java.lang.String unauthArn,
java.lang.String authArn,
AWSSecurityTokenService stsClient)
Constructs a new CognitoCredentialsProvider, which will set up a link to the provider passed in, using that to get short-lived credentials from STS, which can be retrieved from getCredentials() |
|
CognitoCredentialsProvider(java.lang.String accountId,
java.lang.String identityPoolId,
java.lang.String unauthRoleArn,
java.lang.String authRoleArn,
AmazonCognitoIdentityClient cib,
AWSSecurityTokenService sts)
Constructs a new CognitoCredentialsProvider, which will use the
specified Amazon Cognito identity pool to make a request to the AWS
Security Token Service (STS) to request short lived session credentials,
which will then be returned by this class's getCredentials()
method. |
|
CognitoCredentialsProvider(java.lang.String accountId,
java.lang.String identityPoolId,
java.lang.String unauthRoleArn,
java.lang.String authRoleArn,
Regions region)
Constructs a new CognitoCredentialsProvider, which will use the
specified Amazon Cognito identity pool to make a request to the AWS
Security Token Service (STS) to request short lived session credentials,
which will then be returned by this class's getCredentials()
method. |
|
CognitoCredentialsProvider(java.lang.String accountId,
java.lang.String identityPoolId,
java.lang.String unauthRoleArn,
java.lang.String authRoleArn,
Regions region,
ClientConfiguration clientConfiguration)
Constructs a new CognitoCredentialsProvider, which will use the
specified Amazon Cognito identity pool to make a request to the AWS
Security Token Service (STS) to request short lived session credentials,
which will then be returned by this class's getCredentials()
method. |
|
| Method Summary | |
|---|---|
void |
clear()
Clear all in-memory and saved state for the credentials provider. |
AWSSessionCredentials |
getCredentials()
If the current session has expired/credentials are invalid, a new session is started, establishing the credentials. |
java.lang.String |
getIdentityId()
|
AWSIdentityProvider |
getIdentityProvider()
|
java.util.Map<java.lang.String,java.lang.String> |
getLogins()
Get the logins map used to authenticated with Amazon Cognito |
int |
getRefreshThreshold()
Get the refresh threshold for the session credentials created by this client in seconds. |
java.util.Date |
getSessionCredentitalsExpiration()
|
int |
getSessionDuration()
Get the duration of the session credentials created by this client in seconds. |
java.lang.String |
getToken()
|
void |
refresh()
Forces this credentials provider to refresh its credentials. |
void |
registerIdentityChangedListener(IdentityChangedListener listener)
|
void |
setLogins(java.util.Map<java.lang.String,java.lang.String> logins)
Set the logins map used to authenticated with Amazon Cognito. |
void |
setRefreshThreshold(int refreshThreshold)
Set the refresh threshold for the session credentials created by this client in seconds. |
void |
setSessionCredentialsExpiration(java.util.Date expiration)
|
void |
setSessionDuration(int sessionDuration)
Set the duration of the session credentials created by this client in seconds. |
void |
unregisterIdentityChangedListener(IdentityChangedListener listener)
|
AWSCredentialsProvider |
withLogins(java.util.Map<java.lang.String,java.lang.String> logins)
Set the logins map used to authenticated with Amazon Cognito. |
CognitoCredentialsProvider |
withRefreshThreshold(int refreshThreshold)
Set the refresh threshold for the session credentials created by this client in seconds. |
CognitoCredentialsProvider |
withSessionDuration(int sessionDuration)
Set the duration of the session credentials created by this client in seconds. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_DURATION_SECONDS
public static final int DEFAULT_THRESHOLD_SECONDS
| Constructor Detail |
|---|
public CognitoCredentialsProvider(java.lang.String accountId,
java.lang.String identityPoolId,
java.lang.String unauthRoleArn,
java.lang.String authRoleArn,
Regions region)
CognitoCredentialsProvider, which will use the
specified Amazon Cognito identity pool to make a request to the AWS
Security Token Service (STS) to request short lived session credentials,
which will then be returned by this class's getCredentials()
method.
accountId - The AWS accountId for the account with Amazon CognitoidentityPoolId - The Amazon Cogntio identity pool to useunauthRoleArn - The ARN of the IAM Role that will be assumed when
unauthenticatedauthRoleArn - The ARN of the IAM Role that will be assumed when
authenticatedregion - The region to use when contacting Cognito Identity, and STS
(if STS supports the provided regions, otherwise STS will be contacted using the
US_EAST_1 region)
public CognitoCredentialsProvider(java.lang.String accountId,
java.lang.String identityPoolId,
java.lang.String unauthRoleArn,
java.lang.String authRoleArn,
Regions region,
ClientConfiguration clientConfiguration)
CognitoCredentialsProvider, which will use the
specified Amazon Cognito identity pool to make a request to the AWS
Security Token Service (STS) to request short lived session credentials,
which will then be returned by this class's getCredentials()
method.
accountId - The AWS accountId for the account with Amazon CognitoidentityPoolId - The Amazon Cognito identity pool to useunauthRoleArn - The ARN of the IAM Role that will be assumed when
unauthenticatedauthRoleArn - The ARN of the IAM Role that will be assumed when
authenticatedclientConfiguration - Configuration to apply to service clients
createdregion - The region to use when contacting Cognito Identity, and STS
(if STS supports the provided regions, otherwise STS will be contacted using the
US_EAST_1 region)
public CognitoCredentialsProvider(java.lang.String accountId,
java.lang.String identityPoolId,
java.lang.String unauthRoleArn,
java.lang.String authRoleArn,
AmazonCognitoIdentityClient cib,
AWSSecurityTokenService sts)
CognitoCredentialsProvider, which will use the
specified Amazon Cognito identity pool to make a request to the AWS
Security Token Service (STS) to request short lived session credentials,
which will then be returned by this class's getCredentials()
method.
accountId - The AWS accountId for the account with Amazon CognitoidentityPoolId - The Amazon Cogntio identity pool to useunauthRoleArn - The ARN of the IAM Role that will be assumed when
unauthenticatedauthRoleArn - The ARN of the IAM Role that will be assumed when
authenticatedcibClient - Preconfigured CognitoIdentity client to make requests
withstsClient - Preconfigured STS client to make requests with
public CognitoCredentialsProvider(AWSCognitoIdentityProvider provider,
java.lang.String unauthArn,
java.lang.String authArn,
AWSSecurityTokenService stsClient)
getCredentials()
provider - a reference to the provider in question, including what's
needed to interact with it to later connect with STSunauthArn - the unauthArn, for use with the STS callauthArn - the authArn, for use with the STS callstsClient - the sts endpoint to get session credentials from
public CognitoCredentialsProvider(AWSCognitoIdentityProvider provider,
java.lang.String unauthArn,
java.lang.String authArn)
getCredentials()
provider - a reference to the provider in question, including what's
needed to interact with it to later connect with STSunauthArn - the unauthArn, for use with the STS callauthArn - the authArn, for use with the STS call| Method Detail |
|---|
public java.lang.String getIdentityId()
public java.lang.String getToken()
public AWSIdentityProvider getIdentityProvider()
public void setSessionCredentialsExpiration(java.util.Date expiration)
public java.util.Date getSessionCredentitalsExpiration()
public AWSSessionCredentials getCredentials()
getCredentials in interface AWSCredentialsProviderpublic void setSessionDuration(int sessionDuration)
sessionDuration - The new duration for session credentials created
by this providerAssumeRoleWithWebIdentityRequestpublic CognitoCredentialsProvider withSessionDuration(int sessionDuration)
sessionDuration - The new duration for session credentials created
by this provider
AssumeRoleWithWebIdentityRequestpublic int getSessionDuration()
AssumeRoleWithWebIdentityRequestpublic void setRefreshThreshold(int refreshThreshold)
refreshThreshold - The new refresh threshold for session credentials
created by this providerAssumeRoleWithWebIdentityRequestpublic CognitoCredentialsProvider withRefreshThreshold(int refreshThreshold)
refreshThreshold - The new refresh threshold for session credentials
created by this provider
AssumeRoleWithWebIdentityRequestpublic int getRefreshThreshold()
AssumeRoleWithWebIdentityRequestpublic void setLogins(java.util.Map<java.lang.String,java.lang.String> logins)
logins - The new logins map (providerName, providerToken) to use to
communicate with Amazon Cognitopublic AWSCredentialsProvider withLogins(java.util.Map<java.lang.String,java.lang.String> logins)
logins - The new logins map (providerName, providerToken) to use to
communicate with Amazon Cognito
AssumeRoleWithWebIdentityRequestpublic java.util.Map<java.lang.String,java.lang.String> getLogins()
public void refresh()
AWSCredentialsProvider
refresh in interface AWSCredentialsProviderpublic void clear()
public void registerIdentityChangedListener(IdentityChangedListener listener)
public void unregisterIdentityChangedListener(IdentityChangedListener listener)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||