public class AuthConfig extends Object
HTTPBuilder.getAuth()
Modifier and Type | Field and Description |
---|---|
protected HTTPBuilder |
builder |
Constructor and Description |
---|
AuthConfig(HTTPBuilder builder) |
Modifier and Type | Method and Description |
---|---|
void |
basic(String host,
int port,
String user,
String pass)
Set authentication credentials to be used for the given host and port.
|
void |
basic(String user,
String pass)
Set authentication credentials to be used for the current
default host . |
void |
certificate(String certURL,
String password)
Sets a certificate to be used for SSL authentication.
|
void |
ntlm(String host,
int port,
String user,
String pass,
String workstation,
String domain)
Set NTLM authentication credentials to be used for the given host and port.
|
void |
ntlm(String user,
String pass,
String workstation,
String domain)
Set NTLM authentication credentials to be used for the current
default host . |
void |
oauth(String consumerKey,
String consumerSecret,
String accessToken,
String secretToken)
OAuth sign all requests.
|
protected HTTPBuilder builder
public AuthConfig(HTTPBuilder builder)
public void basic(String user, String pass)
default host
. This method name is a bit of
a misnomer, since these credentials will actually work for "digest"
authentication as well.user
- pass
- public void basic(String host, int port, String user, String pass)
host
- port
- user
- pass
- public void ntlm(String user, String pass, String workstation, String domain)
default host
.user
- pass
- workstation
- domain
- public void ntlm(String host, int port, String user, String pass, String workstation, String domain)
host
- port
- user
- pass
- workstation
- domain
- public void certificate(String certURL, String password) throws GeneralSecurityException, IOException
Class.getResource(String)
for how to get a URL from a resource
on the classpath.certURL
- URL to a JKS keystore where the certificate is stored.password
- password to decrypt the keystoreGeneralSecurityException
IOException
public void oauth(String consumerKey, String consumerSecret, String accessToken, String secretToken)
WWW-Authenticate
challenge before sending the
the OAuth header. All requests to all domains will be signed for this
instance.
This assumes you've already generated an accessToken
and
secretToken
for the site you're targeting. For More information
on how to achieve this, see the
Signpost documentation.
consumerKey
- null
if you want to unset
OAuth handling and stop signing requests.consumerSecret
- accessToken
- secretToken
- Copyright © 2008-2014. All Rights Reserved.