dev.dsf.common.config.ProxyConfig Maven / Gradle / Ivy
package dev.dsf.common.config;
import java.util.List;
public interface ProxyConfig
{
/**
* @return may be null
*/
String getUrl();
/**
* @return true
if a proxy url is configured and '*' is not set as a no-proxy url
*/
boolean isEnabled();
/**
* @param targetUrl
* may be null
* @return true
if a proxy url is configured, '*' is not set as a no-proxy url and the given
* targetUrl is not set as a no-proxy url, false
if the given targetUrl is
* null
or blank
* @see #getNoProxyUrls()
* @see String#isBlank()
*/
boolean isEnabled(String targetUrl);
/**
* @return may be null
*/
String getUsername();
/**
* @return may be null
*/
char[] getPassword();
/**
* @return never null
, may be empty
*/
List getNoProxyUrls();
/**
* Returns true
if the given targetUrl is not null
and the domain + port of the
* given targetUrl is configured as a no-proxy URL based on the environment configuration.
*
* Configured no-proxy URLs are matched exactly and against sub-domains. If a port is configured, only URLs with the
* same port (or default port) return a true
result.
*
*
* No-Proxy URL examples
*
* Configured
* Given
* Result
*
*
* foo.bar, test.com:8080
* https://foo.bar/fhir
* true
*
*
* foo.bar, test.com:8080
* https://baz.foo.bar/test
* true
*
*
* foo.bar, test.com:8080
* https://test.com:8080/fhir
* true
*
*
* foo.bar, test.com:8080
* https://test.com/fhir
* false
*
*
* foo.bar:443
* https://foo.bar/fhir
* true
*
*
*
* @param targetUrl
* may be null
* @return true if the given targetUrl is not null
and is configured as a no-proxy url
*/
boolean isNoProxyUrl(String targetUrl);
}