public class FormClient extends BaseHttpClient<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 |
ATTEMPTED_AUTHENTICATION_SUFFIX, callbackUrl, logger, NEEDS_CLIENT_REDIRECTION_PARAMETER
Constructor and Description |
---|
FormClient() |
FormClient(String loginUrl,
UsernamePasswordAuthenticator usernamePasswordAuthenticator) |
FormClient(String loginUrl,
UsernamePasswordAuthenticator usernamePasswordAuthenticator,
UsernameProfileCreator profileCreator) |
Modifier and Type | Method and Description |
---|---|
protected String |
computeErrorMessage(TechnicalException e)
Return the error message depending on the thrown exception.
|
String |
getLoginUrl() |
Mechanism |
getMechanism() |
String |
getPasswordParameter() |
String |
getUsernameParameter() |
protected void |
internalInit() |
protected boolean |
isDirectRedirection() |
protected BaseHttpClient<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() |
retrieveUserProfile
addAuthorizationGenerator, clone, getAuthenticator, getAuthorizationGenerators, getCallbackUrl, getContextualCallbackUrl, getCredentials, getName, getProfileCreator, getRedirectAction, getRedirectionUrl, getStateParameter, getUserProfile, isEnableContextualRedirects, prependHostToUrlIfNotPresent, redirect, setAuthenticator, setAuthorizationGenerator, setAuthorizationGenerators, setCallbackUrl, setEnableContextualRedirects, setName, setProfileCreator
init, reinit
public 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, UsernamePasswordAuthenticator usernamePasswordAuthenticator)
public FormClient(String loginUrl, UsernamePasswordAuthenticator usernamePasswordAuthenticator, UsernameProfileCreator profileCreator)
protected BaseHttpClient<UsernamePasswordCredentials> newClient()
newClient
in class BaseClient<UsernamePasswordCredentials,HttpProfile>
protected void internalInit()
internalInit
in class BaseHttpClient<UsernamePasswordCredentials>
protected RedirectAction retrieveRedirectAction(WebContext context)
retrieveRedirectAction
in class BaseClient<UsernamePasswordCredentials,HttpProfile>
protected UsernamePasswordCredentials retrieveCredentials(WebContext context) throws RequiresHttpAction
retrieveCredentials
in class BaseClient<UsernamePasswordCredentials,HttpProfile>
RequiresHttpAction
protected String computeErrorMessage(TechnicalException e)
e
- public 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 BaseClient<UsernamePasswordCredentials,HttpProfile>
public Mechanism getMechanism()
getMechanism
in class BaseClient<UsernamePasswordCredentials,HttpProfile>
Copyright © 2015. All Rights Reserved.