Package com.microsoft.azure.eventhubs
Class ProxyConfiguration
- java.lang.Object
-
- com.microsoft.azure.eventhubs.ProxyConfiguration
-
- All Implemented Interfaces:
AutoCloseable
public class ProxyConfiguration extends Object implements AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProxyConfiguration.ProxyAuthenticationTypeSupported methods of proxy authentication.
-
Field Summary
Fields Modifier and Type Field Description static ProxyConfigurationSYSTEM_DEFAULTSGets the system defaults for proxy configuration and authentication.
-
Constructor Summary
Constructors Constructor Description ProxyConfiguration(ProxyConfiguration.ProxyAuthenticationType authentication, Proxy proxyAddress, String username, String password)Creates a proxy configuration that uses theproxyAddressand authenticates with providedusername,passwordandauthentication.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProxyConfiguration.ProxyAuthenticationTypeauthentication()Gets the proxy authentication type to use.voidclose()PasswordAuthenticationcredentials()Gets credentials to authenticate against proxy with.booleanhasUserDefinedCredentials()Gets whether the user has defined credentials.booleanisProxyAddressConfigured()Gets whether the proxy address has been configured.ProxyproxyAddress()Gets the proxy address.
-
-
-
Field Detail
-
SYSTEM_DEFAULTS
public static final ProxyConfiguration SYSTEM_DEFAULTS
Gets the system defaults for proxy configuration and authentication.
-
-
Constructor Detail
-
ProxyConfiguration
public ProxyConfiguration(ProxyConfiguration.ProxyAuthenticationType authentication, Proxy proxyAddress, String username, String password)
Creates a proxy configuration that uses theproxyAddressand authenticates with providedusername,passwordandauthentication.- Parameters:
authentication- Authentication method to preemptively use with proxy.proxyAddress- Proxy to use. Ifnullis passed in, then the system configuredProxyis used.username- Optional. Username used to authenticate with proxy. If not specified, the system-wideAuthenticatoris used to fetch credentials.password- Optional. Password used to authenticate with proxy.- Throws:
NullPointerException- ifauthenticationisnull.IllegalArgumentException- ifauthenticationisProxyConfiguration.ProxyAuthenticationType.BASICorProxyConfiguration.ProxyAuthenticationType.DIGESTandusernameorpasswordarenull.
-
-
Method Detail
-
proxyAddress
public Proxy proxyAddress()
Gets the proxy address.- Returns:
- The proxy address. Returns
nullif user creates proxy credentials withSYSTEM_DEFAULTS.
-
credentials
public PasswordAuthentication credentials()
Gets credentials to authenticate against proxy with.- Returns:
- The credentials to authenticate against proxy with. Returns
nullif no credentials were set. This occurs when user usesSYSTEM_DEFAULTS.
-
authentication
public ProxyConfiguration.ProxyAuthenticationType authentication()
Gets the proxy authentication type to use.- Returns:
- The proxy authentication type to use. returns
nullif no authentication type was set. This occurs when user usesSYSTEM_DEFAULTS.
-
hasUserDefinedCredentials
public boolean hasUserDefinedCredentials()
Gets whether the user has defined credentials.- Returns:
- true if the user has defined the credentials to use, false otherwise.
-
isProxyAddressConfigured
public boolean isProxyAddressConfigured()
Gets whether the proxy address has been configured. Used to determine whether to use system-defined or user-defined proxy.- Returns:
- true if the proxy url has been set, and false otherwise.
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-