Class AuthConfig
java.lang.Object
groovyx.net.http.AuthConfig
Encapsulates all configuration related to HTTP authentication methods.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classThis class is used to sign all requests via anHttpRequestInterceptoruntil the context-aware AuthScheme is released in HttpClient 4.1. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSet authentication credentials to be used for the given host and port.voidSet authentication credentials to be used for the currentdefault host.voidcertificate(String certURL, String password) Sets a certificate to be used for SSL authentication.voidSet NTLM authentication credentials to be used for the given host and port.voidSet NTLM authentication credentials to be used for the currentdefault host.voidOAuth sign all requests.
-
Field Details
-
builder
-
-
Constructor Details
-
AuthConfig
-
-
Method Details
-
basic
Set authentication credentials to be used for the currentdefault host. This method name is a bit of a misnomer, since these credentials will actually work for "digest" authentication as well.- Parameters:
user-pass-
-
basic
-
ntlm
Set NTLM authentication credentials to be used for the currentdefault host.- Parameters:
user-pass-workstation-domain-
-
ntlm
-
certificate
public void certificate(String certURL, String password) throws GeneralSecurityException, IOException Sets a certificate to be used for SSL authentication. SeeClass.getResource(String)for how to get a URL from a resource on the classpath.- Parameters:
certURL- URL to a JKS keystore where the certificate is stored.password- password to decrypt the keystore- Throws:
GeneralSecurityExceptionIOException
-
oauth
public void oauth(String consumerKey, String consumerSecret, String accessToken, String secretToken) OAuth sign all requests. Note that this currently does not wait for aWWW-Authenticatechallenge before sending the the OAuth header. All requests to all domains will be signed for this instance.This assumes you've already generated an
accessTokenandsecretTokenfor the site you're targeting. For More information on how to achieve this, see the Signpost documentation.- Parameters:
consumerKey-nullif you want to unset OAuth handling and stop signing requests.consumerSecret-accessToken-secretToken-- Since:
- 0.5.1
-