|
|||||||
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,
Regions region)
Constructs a new CognitoCredentialsProvider, which will set up a link to the provider passed in using the enhanced authentication flow to get short-lived credentials from Amazon Cognito, which can be retrieved from getCredentials() |
|
CognitoCredentialsProvider(AWSCognitoIdentityProvider provider,
Regions region,
ClientConfiguration clientConfiguration)
Constructs a new CognitoCredentialsProvider, which will set up a link to the provider passed in using the enhanced authentication flow to get short-lived credentials from Amazon Cognito, which can be retrieved from getCredentials() |
|
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 the basic authentication flow to get 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 to use the basic authentication flow to get short-lived credentials from STS, which can be retrieved from getCredentials() |
|
CognitoCredentialsProvider(java.lang.String identityPoolId,
Regions region)
Constructs a new CognitoCredentialsProvider , which will use the
specified Amazon Cognito identity pool to make a request to Cognito,
using the enhanced flow, to get short lived session credentials, which
will then be returned by this class's getCredentials() method. |
|
CognitoCredentialsProvider(java.lang.String identityPoolId,
Regions region,
ClientConfiguration clientConfiguration)
Constructs a new CognitoCredentialsProvider , which will use the
specified Amazon Cognito identity pool to make a request to Cognito,
using the enhanced flow, to get 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,
AmazonCognitoIdentityClient cibClient,
AWSSecurityTokenService stsClient)
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 get 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, using the basic
authentication flow, 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, using the basic
authentication flow, 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. |
void |
clearCredentials()
Clear credentials. |
AWSSessionCredentials |
getCredentials()
If the current session has expired/credentials are invalid, a new session is started, establishing the credentials. |
java.lang.String |
getIdentityId()
|
java.lang.String |
getIdentityPoolId()
|
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, using the basic
authentication flow, 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 Identitypublic 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, using the basic
authentication flow, to the AWS Security Token Service (STS) to request
short-lived session credentials, which will then be returned by this
class's getCredentials()
method.
This version of the constructor allows you to specify a client configuration for the Amazon Cognito and STS clients.
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
authenticatedregion
- The region to use when contacting Cognito IdentityclientConfiguration
- Configuration to apply to service clients
createdpublic CognitoCredentialsProvider(java.lang.String identityPoolId, Regions region)
CognitoCredentialsProvider
, which will use the
specified Amazon Cognito identity pool to make a request to Cognito,
using the enhanced flow, to get short lived session credentials, which
will then be returned by this class's getCredentials()
method.
identityPoolId
- The Amazon Cognito identity pool to useregion
- The region to use when contacting Cognito Identitypublic CognitoCredentialsProvider(java.lang.String identityPoolId, Regions region, ClientConfiguration clientConfiguration)
CognitoCredentialsProvider
, which will use the
specified Amazon Cognito identity pool to make a request to Cognito,
using the enhanced flow, to get short lived session credentials, which
will then be returned by this class's getCredentials()
method.
This version of the constructor allows you to specify a client configuration for the Amazon Cognito client.
identityPoolId
- The Amazon Cognito identity pool to useregion
- The region to use when contacting Cognito IdentityclientConfiguration
- Configuration to apply to service clients
createdpublic CognitoCredentialsProvider(java.lang.String accountId, java.lang.String identityPoolId, java.lang.String unauthRoleArn, java.lang.String authRoleArn, AmazonCognitoIdentityClient cibClient, AWSSecurityTokenService stsClient)
CognitoCredentialsProvider
, which will use the
specified Amazon Cognito identity pool to make a request to the AWS
Security Token Service (STS) to get short-lived session credentials,
which will then be returned by this class's getCredentials()
method.
This version of the constructor allows you to specify the Amazon Cognito and STS client to use.
Set the roles and stsClient to null to use the enhanced authentication flow, not contacting STS. Otherwise the basic flow will be used.
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 withpublic CognitoCredentialsProvider(AWSCognitoIdentityProvider provider, java.lang.String unauthArn, java.lang.String authArn)
getCredentials()
This version of the constructor allows you to specify your own Identity Provider class.
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 callpublic CognitoCredentialsProvider(AWSCognitoIdentityProvider provider, java.lang.String unauthArn, java.lang.String authArn, AWSSecurityTokenService stsClient)
getCredentials()
This version of the constructor allows you to specify your own Identity Provider class, and the STS client to use.
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 frompublic CognitoCredentialsProvider(AWSCognitoIdentityProvider provider, Regions region)
getCredentials()
This version of the constructor allows you to specify your own Identity Provider class.
provider
- a reference to the provider in question, including what's
needed to interact with it to later connect with Amazon
Cognitoregion
- The region to use when contacting Cognitopublic CognitoCredentialsProvider(AWSCognitoIdentityProvider provider, Regions region, ClientConfiguration clientConfiguration)
getCredentials()
This version of the constructor allows you to specify your own Identity Provider class and the configuration for the Amazon Cognito client.
provider
- a reference to the provider in question, including what's
needed to interact with it to later connect with Amazon
CognitoclientConfiguration
- Configuration to apply to service clients
createdregion
- The region to use when contacting Cognito IdentityMethod 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 java.lang.String getIdentityPoolId()
public AWSSessionCredentials getCredentials()
getCredentials
in interface AWSCredentialsProvider
public void setSessionDuration(int sessionDuration)
sessionDuration
- The new duration for session credentials created
by this providerAssumeRoleWithWebIdentityRequest
public CognitoCredentialsProvider withSessionDuration(int sessionDuration)
sessionDuration
- The new duration for session credentials created
by this provider
AssumeRoleWithWebIdentityRequest
public int getSessionDuration()
AssumeRoleWithWebIdentityRequest
public void setRefreshThreshold(int refreshThreshold)
refreshThreshold
- The new refresh threshold for session credentials
created by this providerAssumeRoleWithWebIdentityRequest
public CognitoCredentialsProvider withRefreshThreshold(int refreshThreshold)
refreshThreshold
- The new refresh threshold for session credentials
created by this provider
AssumeRoleWithWebIdentityRequest
public int getRefreshThreshold()
AssumeRoleWithWebIdentityRequest
public 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
AssumeRoleWithWebIdentityRequest
public java.util.Map<java.lang.String,java.lang.String> getLogins()
public void refresh()
AWSCredentialsProvider
refresh
in interface AWSCredentialsProvider
public void clear()
public void clearCredentials()
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 |