public class ProxyOptions extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static String |
PROXY_PASSWORD
The configuration key for containing the password for the username who authenticates with the proxy.
|
static String |
PROXY_USERNAME
The configuration key for containing the username who authenticates with the proxy.
|
static ProxyOptions |
SYSTEM_DEFAULTS
Gets the system defaults for proxy configuration and authentication.
|
| Constructor and Description |
|---|
ProxyOptions(ProxyAuthenticationType authentication,
Proxy proxyAddress,
String username,
String password)
Creates a proxy configuration that uses the
proxyAddress and authenticates with provided
username, password and authentication. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Disposes of the configuration along with potential credentials.
|
ProxyAuthenticationType |
getAuthentication()
Gets the proxy authentication type.
|
PasswordAuthentication |
getCredential()
Gets the credentials user provided for authentication of proxy server.
|
Proxy |
getProxyAddress()
Gets the proxy address.
|
boolean |
hasUserDefinedCredentials()
Gets whether the user has defined credentials.
|
boolean |
isProxyAddressConfigured()
Gets whether the proxy address has been configured.
|
public static final String PROXY_USERNAME
public static final String PROXY_PASSWORD
public static final ProxyOptions SYSTEM_DEFAULTS
public ProxyOptions(ProxyAuthenticationType authentication, Proxy proxyAddress, String username, String password)
proxyAddress and authenticates with provided
username, password and authentication.authentication - Authentication method to preemptively use with proxy.proxyAddress - Proxy to use. If null is passed in, then the system configured Proxy
is used.username - Optional. Username used to authenticate with proxy. If not specified, the system-wide
Authenticator is used to fetch credentials.password - Optional. Password used to authenticate with proxy.NullPointerException - if authentication is null.IllegalArgumentException - if authentication is ProxyAuthenticationType.BASIC or
ProxyAuthenticationType.DIGEST and username or password are null.public ProxyAuthenticationType getAuthentication()
null if no authentication type was set. This occurs
when user uses ProxyOptions.SYSTEM_DEFAULTS.public Proxy getProxyAddress()
null if no proxy address was set This occurs when user uses
ProxyOptions.SYSTEM_DEFAULTS.public PasswordAuthentication getCredential()
null if no credential was set. This occurs when user
uses ProxyOptions.SYSTEM_DEFAULTS.public boolean hasUserDefinedCredentials()
public boolean isProxyAddressConfigured()
public void close()
close in interface AutoCloseableCopyright © 2020 Microsoft Corporation. All rights reserved.