public final class ApplicationConfig extends Object
getConfigForHostname(String)
provides a means to obtain network security
configuration to be used for communicating with a specific hostname.
Constructor and Description |
---|
ApplicationConfig(ConfigSource configSource) |
Modifier and Type | Method and Description |
---|---|
NetworkSecurityConfig |
getConfigForHostname(String hostname)
Get the
NetworkSecurityConfig corresponding to the provided hostname. |
static ApplicationConfig |
getDefaultInstance() |
X509TrustManager |
getTrustManager()
Returns the
X509TrustManager that implements the checking of trust anchors and
certificate pinning based on this configuration. |
void |
handleTrustStorageUpdate() |
boolean |
hasPerDomainConfigs() |
boolean |
isCleartextTrafficPermitted()
Returns
true if cleartext traffic is permitted for this application, which is the
case only if all configurations permit cleartext traffic. |
boolean |
isCleartextTrafficPermitted(String hostname)
Returns
true if cleartext traffic is permitted for this application when connecting
to hostname . |
static void |
setDefaultInstance(ApplicationConfig config) |
public ApplicationConfig(ConfigSource configSource)
public boolean hasPerDomainConfigs()
public NetworkSecurityConfig getConfigForHostname(String hostname)
NetworkSecurityConfig
corresponding to the provided hostname.
When matching the most specific matching domain rule will be used, if no match exists
then the default configuration will be returned.
NetworkSecurityConfig
objects returned by this method can be safely cached for
hostname
. Subsequent calls with the same hostname will always return the same
NetworkSecurityConfig
.NetworkSecurityConfig
to be used to determine
the network security configuration for connections to hostname
.public X509TrustManager getTrustManager()
X509TrustManager
that implements the checking of trust anchors and
certificate pinning based on this configuration.public boolean isCleartextTrafficPermitted()
true
if cleartext traffic is permitted for this application, which is the
case only if all configurations permit cleartext traffic. For finer-grained policy use
isCleartextTrafficPermitted(String)
.public boolean isCleartextTrafficPermitted(String hostname)
true
if cleartext traffic is permitted for this application when connecting
to hostname
.public void handleTrustStorageUpdate()
public static void setDefaultInstance(ApplicationConfig config)
public static ApplicationConfig getDefaultInstance()