public class AuthConfig extends Object
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,
String certType,
int port,
KeyStore trustStore,
org.apache.http.conn.ssl.X509HostnameVerifier x509HostnameVerifier,
org.apache.http.conn.ssl.SSLSocketFactory sslSocketFactory)
Sets a certificate to be used for SSL authentication.
|
void |
oauth(String consumerKey,
String consumerSecret,
String accessToken,
String secretToken)
OAuth sign all requests.
|
void |
oauth(String consumerKey,
String consumerSecret,
String accessToken,
String secretToken,
OAuthSignature signature) |
void |
oauth2(String accessToken)
OAuth2 sign all requests.
|
void |
oauth2(String accessToken,
OAuthSignature signature) |
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 certificate(String certURL, String password, String certType, int port, KeyStore trustStore, org.apache.http.conn.ssl.X509HostnameVerifier x509HostnameVerifier, org.apache.http.conn.ssl.SSLSocketFactory sslSocketFactory)
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 keystorecertType
- The certificate typeport
- The SSL porttrustStore
- The trust storex509HostnameVerifier
- The X509HostnameVerifier to usesslSocketFactory
- The SSLSocketFactory to usepublic 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
Scribe documentation.
consumerKey
- null
if you want to unset
OAuth handling and stop signing requests.consumerSecret
- accessToken
- secretToken
- public void oauth(String consumerKey, String consumerSecret, String accessToken, String secretToken, OAuthSignature signature)
public void oauth2(String accessToken)
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
for the site you're targeting. For More information
on how to achieve this, see the
Scribe documentation.
accessToken
- public void oauth2(String accessToken, OAuthSignature signature)
Copyright © 2010–2015. All rights reserved.