| java.lang.Object org.apache.cactus.client.authentication.AbstractAuthentication org.apache.cactus.client.authentication.FormAuthentication
FormAuthentication | public class FormAuthentication extends AbstractAuthentication (Code) | | 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.
since: 1.5 version: $Id: FormAuthentication.java 238991 2004-05-22 11:34:50Z vmassol $ |
FormAuthentication | public FormAuthentication(String theName, String thePassword)(Code) | | Parameters: theName - user name of the Credential Parameters: thePassword - user password of the Credential |
authenticate | public void authenticate(WebRequest theRequest, Configuration theConfiguration)(Code) | | Authenticate the principal by calling the security URL.
Parameters: theRequest - the web request used to connect to the Redirector Parameters: theConfiguration - the Cactus configuration |
checkAuthResponse | protected void checkAuthResponse(HttpURLConnection theConnection) throws Exception(Code) | | 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() .
Parameters: theConnection - a HttpURLConnection value exception: Exception - if the auth step should be considered as failed |
checkPreAuthResponse | protected void checkPreAuthResponse(HttpURLConnection theConnection) throws Exception(Code) | | 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.
Parameters: theConnection - a HttpURLConnection value exception: Exception - if the pre-auth step should be considered as failed |
getExpectedAuthResponse | protected int getExpectedAuthResponse()(Code) | | Get the expected HTTP response status code for an authentication request
which should be successful.
the expected HTTP response status code |
getSecurityCheckURL | public URL getSecurityCheckURL(Configuration theConfiguration)(Code) | | 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.
Parameters: theConfiguration - the Cactus configuration the URL that is being used to attempt to login. |
getSecurityRequest | public WebRequest getSecurityRequest()(Code) | | the WebRequest that will be used to connect to thesecurity URL. It can be used to add additional HTTP parameters suchas proprietary ones required by some containers. |
setExpectedAuthResponse | public void setExpectedAuthResponse(int theExpectedCode)(Code) | | Set the expected HTTP response status code for an authentication request
which should be successful.
The default is HttpURLConnection.HTTP_MOVED_TEMP.
Parameters: theExpectedCode - the expected HTTP response status code value |
setSecurityCheckURL | public void setSecurityCheckURL(URL theUrl)(Code) | | This sets the URL to use when attempting to log in. This method is used
if for whatever reason the default URL is incorrect.
Parameters: theUrl - A URL to use to attempt to login. |
setSessionCookieName | public void setSessionCookieName(String theName)(Code) | | Set the cookie name of the session to theName.
If theName is null, the change request will be ignored.
The default is "JSESSIONID ".
Parameters: theName - the cookie name of the session |
|
|