Class HttpClientSecurityParameters
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.hc.client5.http.auth.AuthCacheHttpClientAuthCacheto allow pre-emptive authentication.private X509CredentialThe X509 credential used for client TLS.private org.apache.hc.client5.http.auth.CredentialsProviderHttpClient credentials provider.private HostnameVerifierThe hostname verifier.private Map<org.apache.hc.core5.http.HttpHost,org.apache.hc.client5.http.auth.UsernamePasswordCredentials> Map of host specifications to basic-auth credentials to be applied preemptively.private BooleanFlag indicating whether failure of server TLS trust engine evaluation should be treated as a fatal error.TLS cipher suites.private CriteriaSetOptional criteria set used in evaluating server TLS credentials.TLS Protocols.private TrustEngine<? super X509Credential>Optional trust engine used in evaluating server TLS credentials. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hc.client5.http.auth.AuthCacheGet an instance ofAuthCacheused for authentication by the HttpClient instance.Get the optional client TLS credential.org.apache.hc.client5.http.auth.CredentialsProviderGet an instance ofCredentialsProviderused for authentication by the HttpClient instance.Get the optional hostname verifier.Map<org.apache.hc.core5.http.HttpHost,org.apache.hc.client5.http.auth.UsernamePasswordCredentials> Get the map of rules for preemptive basic authentication using the supplied hosts and credentials.Get the optional list of TLS cipher suites.Get the optional criteria set used in evaluating server TLS credentials.Get the optional list of TLS protocols.TrustEngine<? super X509Credential>Sets the optional trust engine used in evaluating server TLS credentials.Get the flag indicating whether failure of server TLS trust engine evaluation should be treated as a fatal error.setAuthCache(org.apache.hc.client5.http.auth.AuthCache cache) Deprecated.voidsetBasicCredentials(org.apache.hc.client5.http.auth.UsernamePasswordCredentials credentials) Deprecated.setBasicCredentialsWithScope(org.apache.hc.client5.http.auth.UsernamePasswordCredentials credentials, org.apache.hc.client5.http.auth.AuthScope scope) Deprecated.setClientTLSCredential(X509Credential credential) Set the optional client TLS credential.setCredentialsProvider(org.apache.hc.client5.http.auth.CredentialsProvider provider) Set an instance ofCredentialsProviderused for authentication by the HttpClient instance.setHostnameVerifier(HostnameVerifier verifier) Set the optional hostname verifier.setPreemptiveBasicAuthMap(Map<org.apache.hc.core5.http.HttpHost, org.apache.hc.client5.http.auth.UsernamePasswordCredentials> map) Install a map of rules for preemptive basic authentication using the supplied hosts and credentials.Set the flag indicating whether failure of server TLS trust engine evaluation should be treated as a fatal error.setTLSCipherSuites(Collection<String> cipherSuites) Set the optional list of TLS cipher suites.setTLSCriteriaSet(CriteriaSet criteriaSet) Set the optional criteria set used in evaluating server TLS credentials.setTLSProtocols(Collection<String> protocols) Set the optional list of TLS protocols.setTLSTrustEngine(TrustEngine<? super X509Credential> engine) Sets the optional trust engine used in evaluating server TLS credentials.
-
Field Details
-
credentialsProvider
@Nullable private org.apache.hc.client5.http.auth.CredentialsProvider credentialsProviderHttpClient credentials provider. -
preemptiveBasicAuthMap
@Nullable private Map<org.apache.hc.core5.http.HttpHost,org.apache.hc.client5.http.auth.UsernamePasswordCredentials> preemptiveBasicAuthMapMap of host specifications to basic-auth credentials to be applied preemptively. -
authCache
@Nullable private org.apache.hc.client5.http.auth.AuthCache authCacheHttpClientAuthCacheto allow pre-emptive authentication. -
tlsTrustEngine
Optional trust engine used in evaluating server TLS credentials. -
tlsCriteriaSet
Optional criteria set used in evaluating server TLS credentials. -
tlsProtocols
TLS Protocols. -
tlsCipherSuites
TLS cipher suites. -
hostnameVerifier
The hostname verifier. -
clientTLSCredential
The X509 credential used for client TLS. -
serverTLSFailureFatal
Flag indicating whether failure of server TLS trust engine evaluation should be treated as a fatal error.
-
-
Constructor Details
-
HttpClientSecurityParameters
public HttpClientSecurityParameters()
-
-
Method Details
-
getCredentialsProvider
@Nullable public org.apache.hc.client5.http.auth.CredentialsProvider getCredentialsProvider()Get an instance ofCredentialsProviderused for authentication by the HttpClient instance.- Returns:
- the credentials provider, or null
-
setCredentialsProvider
@Nonnull public HttpClientSecurityParameters setCredentialsProvider(@Nullable org.apache.hc.client5.http.auth.CredentialsProvider provider) Set an instance ofCredentialsProviderused for authentication by the HttpClient instance.- Parameters:
provider- the credentials provider- Returns:
- this object
-
setPreemptiveBasicAuthMap
@Nonnull public HttpClientSecurityParameters setPreemptiveBasicAuthMap(@Nullable Map<org.apache.hc.core5.http.HttpHost, org.apache.hc.client5.http.auth.UsernamePasswordCredentials> map) Install a map of rules for preemptive basic authentication using the supplied hosts and credentials.Use of this feature requires that the eventual
HttpClientContextused be built usingHttpClientSecuritySupport.buildHttpClientContext(HttpClientSecurityParameters).- Parameters:
map- preemptive basic-auth map- Returns:
- this object
- Since:
- 5.0.0
-
getPreemptiveBasicAuthMap
@Nullable @Unmodifiable @NotLive public Map<org.apache.hc.core5.http.HttpHost,org.apache.hc.client5.http.auth.UsernamePasswordCredentials> getPreemptiveBasicAuthMap()Get the map of rules for preemptive basic authentication using the supplied hosts and credentials.- Returns:
- basic-auth rule map or null
- Since:
- 5.0.0
-
getAuthCache
@Nullable public org.apache.hc.client5.http.auth.AuthCache getAuthCache()Get an instance ofAuthCacheused for authentication by the HttpClient instance.- Returns:
- the cache, or null
- Since:
- 3.4.0
-
setAuthCache
@Deprecated @Nonnull public HttpClientSecurityParameters setAuthCache(@Nullable org.apache.hc.client5.http.auth.AuthCache cache) Deprecated.Set an instance ofAuthCacheused for authentication by the HttpClient instance.- Parameters:
cache- the auth cache- Returns:
- this object
- Since:
- 3.4.0
-
setBasicCredentials
@Deprecated public void setBasicCredentials(@Nullable org.apache.hc.client5.http.auth.UsernamePasswordCredentials credentials) Deprecated.A convenience method to set a (single) username and password used for BASIC authentication. To disable BASIC authentication pass null for the credentials instance.An
AuthScopewill be generated which specifies any host, port, scheme and realm.To specify multiple usernames and passwords for multiple host, port, scheme, and realm combinations, instead provide an instance of
CredentialsProviderviasetCredentialsProvider(CredentialsProvider).- Parameters:
credentials- the username and password credentials
-
setBasicCredentialsWithScope
@Deprecated @Nonnull public HttpClientSecurityParameters setBasicCredentialsWithScope(@Nullable org.apache.hc.client5.http.auth.UsernamePasswordCredentials credentials, @Nullable org.apache.hc.client5.http.auth.AuthScope scope) Deprecated.A convenience method to set a (single) username and password used for BASIC authentication. To disable BASIC authentication pass null for the credentials instance.If the
authScopeis null, anAuthScopewill be generated which specifies any host, port, scheme and realm.To specify multiple usernames and passwords for multiple host, port, scheme, and realm combinations, instead provide an instance of
CredentialsProviderviasetCredentialsProvider(CredentialsProvider).- Parameters:
credentials- the username and password credentialsscope- the HTTP client auth scope with which to scope the credentials, may be null- Returns:
- this object
-
getTLSTrustEngine
Sets the optional trust engine used in evaluating server TLS credentials.- Returns:
- the trust engine instance to use, or null
-
setTLSTrustEngine
@Nonnull public HttpClientSecurityParameters setTLSTrustEngine(@Nullable TrustEngine<? super X509Credential> engine) Sets the optional trust engine used in evaluating server TLS credentials.- Parameters:
engine- the trust engine instance to use- Returns:
- this object
-
getTLSCriteriaSet
Get the optional criteria set used in evaluating server TLS credentials.- Returns:
- the criteria set instance to use
-
getTLSProtocols
Get the optional list of TLS protocols.- Returns:
- the TLS protocols, or null
-
setTLSProtocols
@Nonnull public HttpClientSecurityParameters setTLSProtocols(@Nullable Collection<String> protocols) Set the optional list of TLS protocols.- Parameters:
protocols- the TLS protocols or null- Returns:
- this object
-
getTLSCipherSuites
Get the optional list of TLS cipher suites.- Returns:
- the list of TLS cipher suites, or null
-
setTLSCipherSuites
@Nonnull public HttpClientSecurityParameters setTLSCipherSuites(@Nullable Collection<String> cipherSuites) Set the optional list of TLS cipher suites.- Parameters:
cipherSuites- the TLS cipher suites, or null- Returns:
- this object
-
getHostnameVerifier
Get the optional hostname verifier.- Returns:
- the hostname verifier, or null
-
setHostnameVerifier
@Nonnull public HttpClientSecurityParameters setHostnameVerifier(@Nullable HostnameVerifier verifier) Set the optional hostname verifier.- Parameters:
verifier- the hostname verifier, or null- Returns:
- this object
-
getClientTLSCredential
Get the optional client TLS credential.- Returns:
- the client TLS credential, or null
-
setClientTLSCredential
@Nonnull public HttpClientSecurityParameters setClientTLSCredential(@Nullable X509Credential credential) Set the optional client TLS credential.- Parameters:
credential- the client TLS credential, or null- Returns:
- this object
-
isServerTLSFailureFatal
Get the flag indicating whether failure of server TLS trust engine evaluation should be treated as a fatal error.Note: a
Booleanis used here rather thanbooleanto explicitly allow a non-configured value, allowing consuming components to implement their own internal defaults.- Returns:
- true if fatal, false if non-fatal, null if not explicitly configured
-
setServerTLSFailureFatal
Set the flag indicating whether failure of server TLS trust engine evaluation should be treated as a fatal error.Note: a
Booleanis used here rather thanbooleanto explicitly allow a non-configured value, allowing consuming components to implement their own internal defaults.- Parameters:
flag- true if fatal, false if non-fatal, null if not explicitly configured- Returns:
- this object
-
setPreemptiveBasicAuthMap(Map)