Package org.mapfish.print.http
Class HttpCredential
java.lang.Object
org.mapfish.print.http.HttpCredential
- All Implemented Interfaces:
ConfigurationObject
- Direct Known Subclasses:
HttpProxy
Represents a set of credentials to use for an http request. These can be configured in the
Configuration yaml file.
Note: proxies are also HttpCredentials and when searching for credentials, the proxies will also be searched for credentials.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringGet the username.booleanReturns true if this proxy should be used for the provided URI.voidsetMatchers(List<? extends URIMatcher> matchers) Matchers are used to choose which requests the credentials apply to.voidsetPassword(String password) The password for authenticating with the credentials.voidsetUsername(String username) The username for authenticating with the credentials.final org.apache.hc.client5.http.auth.UsernamePasswordCredentialstoCredentials(org.apache.hc.client5.http.auth.AuthScope authscope) Check if this applies to the provided authorization scope and return the credentials for that scope or null if it doesn't apply to the scope.voidvalidate(List<Throwable> validationErrors, Configuration configuration) validate that the configuration was correct.
-
Constructor Details
-
HttpCredential
public HttpCredential()
-
-
Method Details
-
setMatchers
Matchers are used to choose which requests the credentials apply to.- Parameters:
matchers- the matchers to use to determine which requests the credentials can be used for- See Also:
-
getUsername
Get the username. -
setUsername
The username for authenticating with the credentials.This is optional
- Parameters:
username- the username for authenticating with the credentials
-
setPassword
The password for authenticating with the credentials.This is optional
- Parameters:
password- the password for authenticating with the credentials
-
validate
Description copied from interface:ConfigurationObjectvalidate that the configuration was correct.- Specified by:
validatein interfaceConfigurationObject- Parameters:
validationErrors- a list to add any detected errors to.configuration- the containing configuration
-
matches
public boolean matches(MatchInfo matchInfo) throws SocketException, UnknownHostException, MalformedURLException Returns true if this proxy should be used for the provided URI.- Parameters:
matchInfo- the information for making the patch- Throws:
SocketExceptionUnknownHostExceptionMalformedURLException
-
toCredentials
@Nullable public final org.apache.hc.client5.http.auth.UsernamePasswordCredentials toCredentials(org.apache.hc.client5.http.auth.AuthScope authscope) Check if this applies to the provided authorization scope and return the credentials for that scope or null if it doesn't apply to the scope.- Parameters:
authscope- the scope to test against.
-