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 |
extractor
ATTEMPTED_AUTHENTICATION_SUFFIX, callbackUrl, callbackUrlResolver, NEEDS_CLIENT_REDIRECTION_PARAMETER
logger
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()
Return the client type.
|
String |
getLoginUrl() |
String |
getPasswordParameter() |
String |
getUsernameParameter() |
protected void |
internalInit(WebContext context)
Internal initialization of the object.
|
protected boolean |
isDirectRedirection()
Define if this client has a direct redirection.
|
protected IndirectHttpClient<UsernamePasswordCredentials> |
newClient()
Create a new instance of the client.
|
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, setProfileCreator
computeFinalCallbackUrl, getAjaxRequestResolver, getCallbackUrl, getCallbackUrlResolver, getCredentials, getRedirectAction, getRedirectionUrl, getStateParameter, isIncludeClientNameInCallbackUrl, redirect, setAjaxRequestResolver, setCallbackUrl, setCallbackUrlResolver, setIncludeClientNameInCallbackUrl
addAuthorizationGenerator, getAuthorizationGenerators, getName, getUserProfile, setAuthorizationGenerator, setAuthorizationGenerators, setAuthorizationGenerators, setName
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)
public FormClient(String loginUrl, UsernamePasswordAuthenticator usernamePasswordAuthenticator)
public FormClient(String loginUrl, UsernamePasswordAuthenticator usernamePasswordAuthenticator, ProfileCreator profileCreator)
protected IndirectHttpClient<UsernamePasswordCredentials> newClient()
BaseClient
newClient
in class BaseClient<UsernamePasswordCredentials,HttpProfile>
protected void internalInit(WebContext context)
InitializableWebObject
internalInit
in class IndirectHttpClient<UsernamePasswordCredentials>
context
- the web contextprotected RedirectAction retrieveRedirectAction(WebContext context)
retrieveRedirectAction
in class IndirectClient<UsernamePasswordCredentials,HttpProfile>
protected UsernamePasswordCredentials retrieveCredentials(WebContext context) throws RequiresHttpAction
retrieveCredentials
in class IndirectClient<UsernamePasswordCredentials,HttpProfile>
RequiresHttpAction
protected 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()
IndirectClient
isDirectRedirection
in class IndirectClient<UsernamePasswordCredentials,HttpProfile>
public ClientType getClientType()
BaseClient
getClientType
in class BaseClient<UsernamePasswordCredentials,HttpProfile>
Copyright © 2016. All rights reserved.