public class EdgeRcClientCredentialProvider extends Object implements ClientCredentialProvider
ClientCredentialProvider implementation that reads from EdgeRc files. A variety
static methods are available to initially create the object. A default section name is required
at creation time, and sub-classes may override pickSectionName(Request) in order to make
a more complicated decision on a per-request basis.| Constructor and Description |
|---|
EdgeRcClientCredentialProvider(Reader reader,
String section)
Loads an EdgeRc configuration file and returns an
EdgeRcClientCredentialProvider to
read ClientCredentials from it. |
| Modifier and Type | Method and Description |
|---|---|
static EdgeRcClientCredentialProvider |
fromEdgeRc(File file,
String section)
Loads an EdgeRc configuration file and returns an
EdgeRcClientCredentialProvider to
read ClientCredentials from it. |
static EdgeRcClientCredentialProvider |
fromEdgeRc(InputStream inputStream,
String section)
Loads an EdgeRc configuration file and returns an
EdgeRcClientCredentialProvider to
read ClientCredentials from it. |
static EdgeRcClientCredentialProvider |
fromEdgeRc(Reader reader,
String section)
Loads an EdgeRc configuration file and returns an
EdgeRcClientCredentialProvider to
read ClientCredentials from it. |
static EdgeRcClientCredentialProvider |
fromEdgeRc(String filename,
String section)
Loads an EdgeRc configuration file and returns an
EdgeRcClientCredentialProvider to
read ClientCredentials from it. |
ClientCredential |
getClientCredential(Request request)
Gets a
ClientCredential that is appropriate for signing request. |
protected ClientCredential |
getClientCredential(String sectionName)
Gets the
ClientCredential defined in section sectionName. |
protected String |
pickSectionName(Request request)
Picks an appropriate section name from the configuration to sign
request. |
public EdgeRcClientCredentialProvider(Reader reader, String section) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
EdgeRcClientCredentialProvider to
read ClientCredentials from it.reader - an open Reader to an EdgeRc filesection - a config section (null for the default section)org.apache.commons.configuration2.ex.ConfigurationException - If an error occurs while reading the configurationIOException - if an I/O error occurspublic static EdgeRcClientCredentialProvider fromEdgeRc(File file, String section) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
EdgeRcClientCredentialProvider to
read ClientCredentials from it.file - a File pointing to an EdgeRc filesection - a config section (null for the default section)EdgeRcClientCredentialProviderorg.apache.commons.configuration2.ex.ConfigurationException - If an error occurs while reading the configurationIOException - if an I/O error occurspublic static EdgeRcClientCredentialProvider fromEdgeRc(InputStream inputStream, String section) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
EdgeRcClientCredentialProvider to
read ClientCredentials from it.inputStream - an open InputStream to an EdgeRc filesection - a config section (null for the default section)EdgeRcClientCredentialProviderorg.apache.commons.configuration2.ex.ConfigurationException - If an error occurs while reading the configurationIOException - if an I/O error occurspublic static EdgeRcClientCredentialProvider fromEdgeRc(Reader reader, String section) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
EdgeRcClientCredentialProvider to
read ClientCredentials from it.reader - an open Reader to an EdgeRc filesection - a config section (null for the default section)EdgeRcClientCredentialProviderorg.apache.commons.configuration2.ex.ConfigurationException - If an error occurs while reading the configurationIOException - if an I/O error occurspublic static EdgeRcClientCredentialProvider fromEdgeRc(String filename, String section) throws org.apache.commons.configuration2.ex.ConfigurationException, IOException
EdgeRcClientCredentialProvider to
read ClientCredentials from it.filename - a filename pointing to an EdgeRc filesection - a config section (null for the default section)EdgeRcClientCredentialProviderorg.apache.commons.configuration2.ex.ConfigurationException - If an error occurs while reading the configurationIOException - if an I/O error occurspublic ClientCredential getClientCredential(Request request)
ClientCredentialProviderClientCredential that is appropriate for signing request. The result
of this method may be null if no reasonable ClientCredential can be located.getClientCredential in interface ClientCredentialProviderrequest - a RequestClientCredential (can be null)protected ClientCredential getClientCredential(String sectionName)
ClientCredential defined in section sectionName.sectionName - a section name (null for the default section)ClientCredentialprotected String pickSectionName(Request request)
request. By default
this method will always return defaultSectionName, which was provided as part the
object construction. Users may extend this class and override this method to
perform more complex decisions about how to decide which ClientCredential will be
retrieved from the EdgeRc file.request - a Requestnull for the default section)Copyright © 2016–2018. All rights reserved.