com.jayway.restassured.specification
Interface AuthenticationSpecification

All Known Implementing Classes:
AuthenticationSpecificationImpl

public interface AuthenticationSpecification

Specify an authentication scheme to use when sending a request.


Method Summary
 RequestSpecification basic(String userName, String password)
          Use http basic authentication.
 RequestSpecification certificate(String certURL, String password)
          Sets a certificate to be used for SSL authentication.
 RequestSpecification digest(String userName, String password)
          Use http digest authentication.
 RequestSpecification form(String userName, String password)
          Use form authentication.
 RequestSpecification form(String userName, String password, FormAuthConfig config)
          Use form authentication with the supplied configuration.
 RequestSpecification none()
          Explicitly state that you don't which to use any authentication in this request.
 RequestSpecification oauth(String consumerKey, String consumerSecret, String accessToken, String secretToken)
          Excerpt from the HttpBuilder docs:
OAuth sign the request.
 PreemptiveAuthSpec preemptive()
          Returns the preemptive authentication view.
 

Method Detail

basic

RequestSpecification basic(String userName,
                           String password)
Use http basic authentication.

Parameters:
userName - The user name.
password - The password.
Returns:
The Request specification

digest

RequestSpecification digest(String userName,
                            String password)
Use http digest authentication.

Parameters:
userName - The user name.
password - The password.
Returns:
The Request specification

form

RequestSpecification form(String userName,
                          String password)
Use form authentication. Rest Assured will try to parse the response login page and determine and try find the action, username and password input field automatically.

Parameters:
userName - The user name.
password - The password.
Returns:
The Request specification

form

RequestSpecification form(String userName,
                          String password,
                          FormAuthConfig config)
Use form authentication with the supplied configuration.

Parameters:
userName - The user name.
password - The password.
config - The form authentication config
Returns:
The authentication scheme

certificate

RequestSpecification certificate(String certURL,
                                 String password)
Sets a certificate to be used for SSL authentication. See Class.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
Returns:
Request specification

oauth

RequestSpecification oauth(String consumerKey,
                           String consumerSecret,
                           String accessToken,
                           String secretToken)
Excerpt from the HttpBuilder docs:
OAuth sign the request. Note that this currently does not wait for a 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.

Parameters:
consumerKey -
consumerSecret -
accessToken -
secretToken -
Returns:
The request com.jayway.restassured.specification

preemptive

PreemptiveAuthSpec preemptive()
Returns the preemptive authentication view. This means that the authentication details are sent in the request header regardless if the server has challenged for authentication or not.

Returns:
The preemptive authentication specification.

none

RequestSpecification none()
Explicitly state that you don't which to use any authentication in this request. This is useful only in cases where you've specified a default authentication scheme and you wish to override it for a single request.

Returns:
The Request specification


Copyright © 2010-2011. All Rights Reserved.