* Copyright 2012-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
implementation that chains together multiple credentials providers. When a caller first requests credentials from this provider, it calls all the providers in the chain, in the original order specified, until one can provide credentials, and then returns those credentials. If all of the credential providers in the chain have been called, and none of them can provide credentials, then this class will throw an exception indicated that no credentials are available.
By default, this class will remember the first credentials provider in the chain
that was able to provide credentials, and will continue to use that provider when
credentials are requested in the future, instead of traversing the chain each time.
This behavior can be controlled through the
credentialsProvidersThe chain of credentials providers.
if (credentialsProviders == null || credentialsProviders.length == 0)
bWhether to enable or disable reusing the last successful credentials provider for future credentials requests instead of searching through the whole chain.
// Ignore any exceptions and move onto the next provider
throw new AmazonClientException("Unable to load AWS credentials from any provider in the chain");