public class FormClient extends IndirectHttpClient<UsernamePasswordCredentials>
This class is the client to authenticate users through HTTP form.
The login url of the form must be defined through the setLoginUrl(String) method. For authentication, the user is redirected to
this login form. The username and password inputs must be posted on the callback url. Their names can be defined by using the
setUsernameParameter(String) and setPasswordParameter(String) methods.
It returns a HttpProfile.
HttpProfile| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_PASSWORD_PARAMETER |
static String |
DEFAULT_USERNAME_PARAMETER |
static String |
ERROR_PARAMETER |
static String |
MISSING_FIELD_ERROR |
extractorATTEMPTED_AUTHENTICATION_SUFFIX, callbackUrl, callbackUrlResolver, NEEDS_CLIENT_REDIRECTION_PARAMETERlogger| Constructor and Description |
|---|
FormClient() |
FormClient(String loginUrl) |
FormClient(String loginUrl,
UsernamePasswordAuthenticator usernamePasswordAuthenticator) |
FormClient(String loginUrl,
UsernamePasswordAuthenticator usernamePasswordAuthenticator,
ProfileCreator profileCreator) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
computeErrorMessage(TechnicalException e)
Return the error message depending on the thrown exception.
|
ClientType |
getClientType() |
String |
getLoginUrl() |
String |
getPasswordParameter() |
String |
getUsernameParameter() |
protected void |
initializeClientConfiguration(WebContext context) |
protected void |
internalInit(WebContext context) |
protected boolean |
isDirectRedirection() |
protected IndirectHttpClient<UsernamePasswordCredentials> |
newClient() |
protected UsernamePasswordCredentials |
retrieveCredentials(WebContext context) |
protected RedirectAction |
retrieveRedirectAction(WebContext context) |
void |
setLoginUrl(String loginUrl) |
void |
setPasswordParameter(String passwordParameter) |
void |
setUsernameParameter(String usernameParameter) |
String |
toString() |
clone, getAuthenticator, getProfileCreator, retrieveUserProfile, setAuthenticator, setProfileCreatorcomputeFinalCallbackUrl, getAjaxRequestResolver, getCallbackUrl, getCallbackUrlResolver, getCredentials, getRedirectAction, getRedirectionUrl, getStateParameter, isIncludeClientNameInCallbackUrl, redirect, setAjaxRequestResolver, setCallbackUrl, setCallbackUrlResolver, setIncludeClientNameInCallbackUrladdAuthorizationGenerator, getAuthorizationGenerators, getName, getUserProfile, setAuthorizationGenerator, setAuthorizationGenerators, setAuthorizationGenerators, setNameinit, reinitpublic static final String ERROR_PARAMETER
public static final String MISSING_FIELD_ERROR
public static final String DEFAULT_USERNAME_PARAMETER
public static final String DEFAULT_PASSWORD_PARAMETER
public FormClient()
public FormClient(String loginUrl)
public FormClient(String loginUrl, UsernamePasswordAuthenticator usernamePasswordAuthenticator)
public FormClient(String loginUrl, UsernamePasswordAuthenticator usernamePasswordAuthenticator, ProfileCreator profileCreator)
protected IndirectHttpClient<UsernamePasswordCredentials> newClient()
newClient in class BaseClient<UsernamePasswordCredentials,HttpProfile>protected void internalInit(WebContext context)
internalInit in class IndirectHttpClient<UsernamePasswordCredentials>protected void initializeClientConfiguration(WebContext context)
protected RedirectAction retrieveRedirectAction(WebContext context)
retrieveRedirectAction in class IndirectClient<UsernamePasswordCredentials,HttpProfile>protected UsernamePasswordCredentials retrieveCredentials(WebContext context) throws RequiresHttpAction
retrieveCredentials in class IndirectClient<UsernamePasswordCredentials,HttpProfile>RequiresHttpActionprotected String computeErrorMessage(TechnicalException e)
e - the technical exceptionpublic String getLoginUrl()
public void setLoginUrl(String loginUrl)
public String getUsernameParameter()
public void setUsernameParameter(String usernameParameter)
public String getPasswordParameter()
public void setPasswordParameter(String passwordParameter)
public String toString()
toString in class BaseClient<UsernamePasswordCredentials,HttpProfile>protected boolean isDirectRedirection()
isDirectRedirection in class IndirectClient<UsernamePasswordCredentials,HttpProfile>public ClientType getClientType()
getClientType in class BaseClient<UsernamePasswordCredentials,HttpProfile>Copyright © 2016. All Rights Reserved.