Save This Page
Home » cactus-1.8.0-src » org.apache.cactus.client.authentication » [javadoc | source]
org.apache.cactus.client.authentication
public class: FormAuthentication [javadoc | source]
java.lang.Object
   org.apache.cactus.client.authentication.AbstractAuthentication
      org.apache.cactus.client.authentication.FormAuthentication

All Implemented Interfaces:
    Authentication

Form-based authentication implementation. An instance of this class can be reused across several tests as it caches the session cookie. Thus the first time it is used to authenticate the user, it calls the security URL (which is by default the context URL prepended by "j_security_check"), caches the returned session cookie and adds the cookie for the next request. The second time it is called, it simply addes the session cookie for the next request.
Constructor:
 public FormAuthentication(String theName,
    String thePassword) 
    Parameters:
    theName - user name of the Credential
    thePassword - user password of the Credential
Method from org.apache.cactus.client.authentication.FormAuthentication Summary:
authenticate,   checkAuthResponse,   checkPreAuthResponse,   configure,   getExpectedAuthResponse,   getSecurityCheckURL,   getSecurityRequest,   setExpectedAuthResponse,   setSecurityCheckURL,   setSessionCookieName
Methods from org.apache.cactus.client.authentication.AbstractAuthentication:
getName,   getPassword,   setName,   setPassword
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.cactus.client.authentication.FormAuthentication Detail:
 public  void authenticate(WebRequest theRequest,
    Configuration theConfiguration) 
    Authenticate the principal by calling the security URL.
 protected  void checkAuthResponse(HttpURLConnection theConnection) throws Exception 
    Check if the auth step can be considered as succeeded or not. As default, the step considered as succeeded if the response status code of theConnection equals getExpectedAuthResponse().
 protected  void checkPreAuthResponse(HttpURLConnection theConnection) throws Exception 
    Check if the pre-auth step can be considered as succeeded or not. As default, the step considered as succeeded if the response status code of theConnection is less than 400.
 public  void configure(HttpState theState,
    HttpMethod theMethod,
    WebRequest theRequest,
    Configuration theConfiguration) 
    {@inheritDoc}
 protected int getExpectedAuthResponse() 
    Get the expected HTTP response status code for an authentication request which should be successful.
 public URL getSecurityCheckURL(Configuration theConfiguration) 
    This returns the URL to use when attempting to log in. By default, it's the context URL defined in the Cactus configuration with "/j_security_check" appended.
 public WebRequest getSecurityRequest() 
 public  void setExpectedAuthResponse(int theExpectedCode) 
    Set the expected HTTP response status code for an authentication request which should be successful. The default is HttpURLConnection.HTTP_MOVED_TEMP.
 public  void setSecurityCheckURL(URL theUrl) 
    This sets the URL to use when attempting to log in. This method is used if for whatever reason the default URL is incorrect.
 public  void setSessionCookieName(String theName) 
    Set the cookie name of the session to theName. If theName is null, the change request will be ignored. The default is "JSESSIONID".