public class AWSCredentialsProviderChain extends Object implements AWSCredentialsProvider
AWSCredentialsProvider
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 setReuseLastProvider(boolean)
method.
构造器和说明 |
---|
AWSCredentialsProviderChain(AWSCredentialsProvider... credentialsProviders)
Constructs a new AWSCredentialsProviderChain with the specified
credential providers.
|
限定符和类型 | 方法和说明 |
---|---|
AWSCredentials |
getCredentials()
Returns AWSCredentials which the caller can use to authorize an AWS request.
|
boolean |
getReuseLastProvider()
Returns true if this chain will reuse the last successful credentials
provider for future credentials requests, otherwise, false if it will
search through the chain each time.
|
void |
refresh()
Forces this credentials provider to refresh its credentials.
|
void |
setReuseLastProvider(boolean b)
Enables or disables caching of the last successful credentials provider
in this chain.
|
public AWSCredentialsProviderChain(AWSCredentialsProvider... credentialsProviders)
credentialsProviders
- The chain of credentials providers.public boolean getReuseLastProvider()
public void setReuseLastProvider(boolean b)
b
- Whether to enable or disable reusing the last successful
credentials provider for future credentials requests instead
of searching through the whole chain.public AWSCredentials getCredentials()
AWSCredentialsProvider
getCredentials
在接口中 AWSCredentialsProvider
public void refresh()
AWSCredentialsProvider
refresh
在接口中 AWSCredentialsProvider
Copyright © 2016. All rights reserved.