当前位置: 首页>>代码示例>>Java>>正文


Java CognitoCachingCredentialsProvider类代码示例

本文整理汇总了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);
}
 
开发者ID:morcmarc,项目名称:react-native-cognito,代码行数:19,代码来源:ReactCognitoModule.java

示例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;
}
 
开发者ID:pgodzin,项目名称:QuotesSocial,代码行数:25,代码来源:MainPageListFragment.java

示例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();
}
 
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:24,代码来源:TemperatureActivity.java

示例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);
    }
 
开发者ID:KwalaGroup,项目名称:Android-Client,代码行数:26,代码来源:NetworkStore.java

示例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);
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:9,代码来源:PollyPlayer.java

示例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
        );

}
 
开发者ID:jtran064,项目名称:PlatePicks-Android,代码行数:13,代码来源:IdentityManager.java

示例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;
}
 
开发者ID:nogalavi,项目名称:Bikeable,代码行数:35,代码来源:MainActivity.java

示例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);
}
 
开发者ID:jinman,项目名称:snake-game-aws,代码行数:16,代码来源:AWSClientManager.java

示例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);
}
 
开发者ID:magnetsystems,项目名称:message-samples-android,代码行数:14,代码来源:S3UploadService.java

示例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;
}
 
开发者ID:pamu,项目名称:upman,代码行数:10,代码来源:S3Uploader.java

示例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);

}
 
开发者ID:aws-samples,项目名称:aws-mobile-self-paced-labs-samples,代码行数:14,代码来源:AWSClientManager.java

示例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);
}
 
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:12,代码来源:MainActivity.java

示例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);
}
 
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:17,代码来源:DatabaseAccess.java

示例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));
}
 
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:10,代码来源:AmazonClientManager.java

示例15: getCredentialsProvider

import com.amazonaws.auth.CognitoCachingCredentialsProvider; //导入依赖的package包/类
/**
 * @return the Cognito credentials provider.
 */
public CognitoCachingCredentialsProvider getCredentialsProvider() {
    return this.credentialsProvider;
}
 
开发者ID:jtran064,项目名称:PlatePicks-Android,代码行数:7,代码来源:IdentityManager.java


注:本文中的com.amazonaws.auth.CognitoCachingCredentialsProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。