本文整理汇总了Java中com.amazonaws.auth.CognitoCachingCredentialsProvider类的典型用法代码示例。如果您正苦于以下问题:Java CognitoCachingCredentialsProvider类的具体用法?Java CognitoCachingCredentialsProvider怎么用?Java CognitoCachingCredentialsProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CognitoCachingCredentialsProvider类属于com.amazonaws.auth包,在下文中一共展示了CognitoCachingCredentialsProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initCredentialsProvider
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
@ReactMethod
public void initCredentialsProvider(String identityPoolId, String token, String region)
{
RegionUtils regionUtils = new RegionUtils();
Region awsRegion = regionUtils.getRegion(region);
cognitoCredentialsProvider = new CognitoCachingCredentialsProvider(
mActivityContext.getApplicationContext(),
identityPoolId,
// awsRegion);
Regions.EU_WEST_1);
cognitoClient = new CognitoSyncManager(
mActivityContext.getApplicationContext(),
// awsRegion,
Regions.EU_WEST_1,
cognitoCredentialsProvider);
}
示例2: doInBackground
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
protected AmazonSimpleDBClient doInBackground(String... urls) {
if (isNetworkAvailable(getActivity())) {
try {
// Initialize the Amazon Cognito credentials provider
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
getActivity().getApplicationContext(), // Context
"us-east-1:1caef7b3-7585-4ded-961d-0cc8f4bbc87f", // Identity Pool ID
Regions.US_EAST_1 // Region
);
Map<String, String> logins = new HashMap<String, String>();
logins.put("graph.facebook.com", Session.getActiveSession().getAccessToken());
credentialsProvider.withLogins(logins);
Log.d("SimpleDBClient", "My ID is " + credentialsProvider.getIdentityId());
AmazonSimpleDBClient client = new AmazonSimpleDBClient(credentialsProvider);
return client;
} catch (Exception e) {
this.exception = e;
return null;
}
} else return null;
}
示例3: onCreate
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Initialize the Amazon Cognito credentials provider
credentialsProvider = new CognitoCachingCredentialsProvider(
getApplicationContext(),
COGNITO_POOL_ID, // Identity Pool ID
MY_REGION // Region
);
iotDataClient = new AWSIotDataClient(credentialsProvider);
String iotDataEndpoint = CUSTOMER_SPECIFIC_ENDPOINT;
iotDataClient.setEndpoint(iotDataEndpoint);
NumberPicker np = (NumberPicker) findViewById(R.id.setpoint);
np.setMinValue(60);
np.setMaxValue(80);
np.setWrapSelectorWheel(false);
getShadows();
}
示例4: NetworkStore
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
NetworkStore() {
kwalaCookieStore = new KwalaCookieStore(KwalaApplication.getInstance());
CookieManager cookieManager = new CookieManager(kwalaCookieStore, CookiePolicy.ACCEPT_ORIGINAL_SERVER);
CookieHandler.setDefault(cookieManager);
okHttpClient = new OkHttpClient.Builder()
.cookieJar(new JavaNetCookieJar(cookieManager))
.authenticator(authenticator)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.build();
KwalaApplication application = KwalaApplication.getInstance();
// Initialize the Amazon Cognito credentials provider
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(application,
KwalaConstants.Network.AWS_IDENTITY_POOL_ID,
Regions.US_EAST_1
);
// Initialize Amazon S3 and transfer utility
s3Client = new AmazonS3Client(credentialsProvider);
transferUtility = new TransferUtility(s3Client, application);
}
示例5: initPollyClient
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
private void initPollyClient(Context context, String awsPoolId) {
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
context,
awsPoolId,
Regions.US_EAST_1
);
pollyClient = new AmazonPollyPresigningClient(credentialsProvider);
}
示例6: initializeCognito
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
private void initializeCognito(final Context context, final ClientConfiguration clientConfiguration) {
AWSRefreshingCognitoIdentityProvider cognitoIdentityProvider = new AWSRefreshingCognitoIdentityProvider(
null, AWSConfiguration.AMAZON_COGNITO_IDENTITY_POOL_ID, clientConfiguration);
credentialsProvider =
new CognitoCachingCredentialsProvider(context,
cognitoIdentityProvider,
AWSConfiguration.AMAZON_COGNITO_REGION,
clientConfiguration
);
}
示例7: doInBackground
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
// init iria data
IriaData.initIriaData();
// Initialize the Amazon Cognito credentials provider
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
getApplicationContext(),
"eu-west-1:75f8b90a-9b52-485b-86c4-bc517b8ad22b", // Identity Pool ID
Regions.EU_WEST_1 // Region
);
AmazonDynamoDBClient ddbClient = Region.getRegion(Regions.EU_WEST_1)
.createClient(
AmazonDynamoDBClient.class,
credentialsProvider,
new ClientConfiguration()
);
mapper = new DynamoDBMapper(ddbClient);
// get iria data
try {
ConstantsFromTable bikePathLayerUrl = mapper.load(ConstantsFromTable.class, "bikePathLayerUrl");
ConstantsFromTable telOfanLayerUrl = mapper.load(ConstantsFromTable.class, "telOfanLayerUrl");
ConstantsFromTable telOFunSiteURL = mapper.load(ConstantsFromTable.class, "telOFunStationsURL");
IriaData.getIriaData(bikePathLayerUrl, telOfanLayerUrl, telOFunSiteURL);
IriaData.isDataReceived = true;
} catch (Exception e) { // There was a problem getting the data from the Municipality site
Log.i("INFO:", "in main activity Data from iria is NOT OK");
IriaData.isDataReceived = false;
e.printStackTrace();
}
return null;
}
示例8: init
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
public static void init(Context context)
{
provider = new CognitoCachingCredentialsProvider(context,
AWS_ACCOUNT_ID, COGNITO_POOL_ID, COGNTIO_ROLE_UNAUTH,
COGNITO_ROLE_AUTH, Regions.US_EAST_1);
//initialize the clients
cognitosync = new CognitoSyncManager(context, Regions.US_EAST_1, provider);
manager = new TransferManager(provider);
ddb = new AmazonDynamoDBClient(provider);
//ddbmapper = new DynamoDBMapper(ddb);
analytics = MobileAnalyticsManager.getOrCreateInstance(context, MOBILE_ANALYTICS_APP_ID, Regions.US_EAST_1, provider);
kinesis = new KinesisRecorder(context.getDir(KINESIS_DIRECTORY_NAME, 0), Regions.US_EAST_1, provider);
lambda = new LambdaInvokerFactory(context, Regions.US_WEST_2, provider);
}
示例9: init
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
/**
* Initializes the AWS S3 credentials provider and transfer manager
*/
public static void init(Context context) {
// Initialize the Amazon Cognito credentials provider
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
context.getApplicationContext(), // Context
AWS_IDENTITY_POOL_ID, // Identity Pool ID
AWS_REGION // Region
);
mS3Client = new AmazonS3Client(credentialsProvider);
sTransferUtility = new TransferUtility(mS3Client, context);
}
示例10: getTransferManager
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
public static TransferManager getTransferManager(Context context) {
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
context,
"us-east-1:c2432cb5-55e1-42ec-a12f-4be2bc8abd9a",
Regions.US_EAST_1
);
TransferManager transferManager = new TransferManager(credentialsProvider);
return transferManager;
}
示例11: init
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
public static void init(Context context)
{
provider = new CognitoCachingCredentialsProvider(context,
AWS_ACCOUNT_ID, COGNITO_POOL_ID, COGNTIO_ROLE_UNAUTH,
COGNITO_ROLE_AUTH, Regions.US_EAST_1);
//initialize the Cognito Sync Client
//initialize the Other Clients
manager = new TransferManager(provider);
analytics = MobileAnalyticsManager.getOrCreateInstance(context, "App_ID_Here", Regions.US_EAST_1, provider);
}
示例12: initPollyClient
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
void initPollyClient() {
// Initialize the Amazon Cognito credentials provider.
credentialsProvider = new CognitoCachingCredentialsProvider(
getApplicationContext(),
COGNITO_POOL_ID,
MY_REGION
);
// Create a client that supports generation of presigned URLs.
client = new AmazonPollyPresigningClient(credentialsProvider);
}
示例13: DatabaseAccess
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
/**
* Creates a new DatabaseAccess instance.
* @param context the calling context
*/
private DatabaseAccess(Context context) {
this.context = context;
// Create a new credentials provider
credentialsProvider = new CognitoCachingCredentialsProvider(context, COGNITO_POOL_ID, COGNITO_REGION);
// Create a connection to the DynamoDB service
dbClient = new AmazonDynamoDBClient(credentialsProvider);
// Create a table reference
dbTable = Table.loadTable(dbClient, DYNAMODB_TABLE);
}
示例14: initClients
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
private void initClients() {
CognitoCachingCredentialsProvider credentials = new CognitoCachingCredentialsProvider(
context,
Constants.IDENTITY_POOL_ID,
Constants.COGNITO_REGION);
ddb = new AmazonDynamoDBClient(credentials);
ddb.setRegion(Region.getRegion(Constants.DYNAMODB_REGION));
}
示例15: getCredentialsProvider
import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
/**
* @return the Cognito credentials provider.
*/
public CognitoCachingCredentialsProvider getCredentialsProvider() {
return this.credentialsProvider;
}