public class AuthConfig extends Object
Modifier and Type | Field and Description |
---|---|
protected HTTPBuilder |
builder |
Constructor and Description |
---|
AuthConfig(HTTPBuilder builder,
OAuthConfig restAssuredOAuthConfig) |
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(Object keyStorePath,
String keyStorePassword,
String keyStoreType,
KeyStore keyStore,
Object trustStorePath,
String trustStorePassword,
String trustStoreType,
KeyStore trustStore,
int port,
org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier,
org.apache.http.conn.ssl.SSLSocketFactory sslConnectionSocketFactory)
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.
|
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, OAuthConfig restAssuredOAuthConfig)
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
- public void ntlm(String host, int port, String user, String pass, String workstation, String domain)
host
- port
- user
- pass
- workstation
- domain
- public void certificate(Object keyStorePath, String keyStorePassword, String keyStoreType, KeyStore keyStore, Object trustStorePath, String trustStorePassword, String trustStoreType, KeyStore trustStore, int port, org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier, org.apache.http.conn.ssl.SSLSocketFactory sslConnectionSocketFactory)
Class.getResource(String)
for how to get a URL from a resource
on the classpath.keyStorePath
- URL to a JKS keystore where the certificate is stored.keyStorePassword
- password to decrypt the keystorekeyStoreType
- The certificate typekeyStore
- The key storetrustStorePath
- URL to a trust storetrustStorePassword
- password to decrypt the trust storetrustStoreType
- The certificate typetrustStore
- The trust storeport
- The SSL porthostnameVerifier
- The X509HostnameVerifier to usesslConnectionSocketFactory
- The SSLConnectionSocketFactory 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–2019. All rights reserved.