|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dtolabs.client.utils.BaseFormAuthenticator
public abstract class BaseFormAuthenticator
BaseFormAuthenticator provides base implementation of authenticator by posting login information to the
j_security_check authorization mechanism. If a 401 UNAUTHORIZED response is detected, then authentication is passed
on to the BasicAuthenticator
. This class is abstract and all abstract methods
should be implemented by subclasses:
getInitialPath()
- returns value of app context or base
pathisValidLoginRedirect(org.apache.commons.httpclient.HttpMethod)
- return true if the HttpMethod
response is a valid redirect after login form is submittedisLoginError(org.apache.commons.httpclient.HttpMethod)
- return true if the HttpMethod response indicates an error occurredisFollowLoginRedirect()
-
return true if authenticator should follow any redirect returned after login form is submitted
Field Summary | |
---|---|
static java.lang.String |
HTTP_SECURE_PROTOCOL
Secure protocol: "https" |
static java.lang.String |
J_SECURITY_CHECK
|
static java.lang.String |
JAVA_AUTH_PATH
path for java auth form submit: "/j_security_check" |
static java.lang.String |
JAVA_PASS_PARAM
password param for java auth form submit: "j_password" |
static java.lang.String |
JAVA_SESSION_COOKIE_NAME
Cookie name for java auth session: "JSESSIONID" |
static java.util.regex.Pattern |
JAVA_SESSION_COOKIE_PATTERN
|
static java.lang.String |
JAVA_USER_PARAM
username param for java auth form submit: "j_username" |
static org.apache.log4j.Logger |
logger
logger |
static java.lang.String |
LOGIN_PAGE
Text to check Location of redirects to indicate login is required. |
Constructor Summary | |
---|---|
BaseFormAuthenticator(java.lang.String basePath,
java.lang.String username,
java.lang.String password)
Constructor with base URL path, username and password for authentication. |
Method Summary | |
---|---|
boolean |
authenticate(java.net.URL baseURL,
org.apache.commons.httpclient.HttpClient client)
Authenticate the client http state so that the colony requests can be made. |
java.lang.String |
getBasePath()
|
java.lang.String |
getCookieId()
|
java.lang.String |
getUsername()
Gets the user login name used when instantiating the authenticator |
static boolean |
hasSessionCookie(java.net.URL reqUrl,
org.apache.commons.httpclient.HttpState state,
java.lang.String basePath)
Check the http state cookies to see if we have the proper session id cookie |
boolean |
needsReAuthentication(int resultCode,
org.apache.commons.httpclient.HttpMethod method)
Return true if the result from the get method indicates re-authentication is needed |
void |
setCookieId(java.lang.String cookieId)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger logger
public static final java.lang.String J_SECURITY_CHECK
public static final java.lang.String JAVA_AUTH_PATH
public static final java.lang.String JAVA_USER_PARAM
public static final java.lang.String JAVA_PASS_PARAM
public static final java.lang.String JAVA_SESSION_COOKIE_NAME
public static final java.util.regex.Pattern JAVA_SESSION_COOKIE_PATTERN
public static final java.lang.String HTTP_SECURE_PROTOCOL
public static final java.lang.String LOGIN_PAGE
Constructor Detail |
---|
public BaseFormAuthenticator(java.lang.String basePath, java.lang.String username, java.lang.String password)
basePath
- base URL path to use with the serverusername
- username to usepassword
- password to useMethod Detail |
---|
public boolean authenticate(java.net.URL baseURL, org.apache.commons.httpclient.HttpClient client) throws HttpClientException
authenticate
in interface HttpAuthenticator
baseURL
- URL requested for colonyclient
- HttpClient instance
HttpClientException
public static boolean hasSessionCookie(java.net.URL reqUrl, org.apache.commons.httpclient.HttpState state, java.lang.String basePath)
reqUrl
- URL being requestedstate
- HTTP state objectbasePath
- base path of requests
public boolean needsReAuthentication(int resultCode, org.apache.commons.httpclient.HttpMethod method)
needsReAuthentication
in interface HttpAuthenticator
resultCode
- result codemethod
- request
public java.lang.String getUsername()
HttpAuthenticator
getUsername
in interface HttpAuthenticator
public java.lang.String getBasePath()
public java.lang.String getCookieId()
public void setCookieId(java.lang.String cookieId)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |