public class FormClient extends IndirectClient<UsernamePasswordCredentials,CommonProfile>
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.
| Modifier and Type | Field and Description |
|---|---|
static String |
ERROR_PARAMETER |
static String |
MISSING_FIELD_ERROR |
ATTEMPTED_AUTHENTICATION_SUFFIX, callbackUrl, urlResolverlogger| Constructor and Description |
|---|
FormClient() |
FormClient(String loginUrl,
Authenticator usernamePasswordAuthenticator) |
FormClient(String loginUrl,
Authenticator usernamePasswordAuthenticator,
ProfileCreator profileCreator) |
FormClient(String loginUrl,
String usernameParameter,
String passwordParameter,
Authenticator usernamePasswordAuthenticator) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clientInit(WebContext context) |
protected String |
computeErrorMessage(Exception e)
Return the error message depending on the thrown exception.
|
String |
getLoginUrl() |
String |
getPasswordParameter() |
String |
getUsernameParameter() |
protected HttpAction |
handleInvalidCredentials(WebContext context,
String username,
String message,
String errorMessage) |
protected UsernamePasswordCredentials |
retrieveCredentials(WebContext context) |
void |
setLoginUrl(String loginUrl) |
void |
setPasswordParameter(String passwordParameter) |
void |
setUsernameParameter(String usernameParameter) |
String |
toString() |
computeFinalCallbackUrl, defaultLogoutActionBuilder, defaultRedirectActionBuilder, getAjaxRequestResolver, getCallbackUrl, getCallbackUrlResolver, getCredentials, getLogoutAction, getLogoutActionBuilder, getRedirectAction, getRedirectActionBuilder, getUrlResolver, internalInit, isIncludeClientNameInCallbackUrl, redirect, setAjaxRequestResolver, setCallbackUrl, setCallbackUrlResolver, setIncludeClientNameInCallbackUrl, setLogoutActionBuilder, setRedirectActionBuilder, setUrlResolveraddAuthorizationGenerator, addAuthorizationGenerators, defaultAuthenticator, defaultCredentialsExtractor, defaultProfileCreator, getAuthenticator, getAuthorizationGenerators, getCredentialsExtractor, getName, getProfileCreator, getUserProfile, notifySessionRenewal, retrieveUserProfile, setAuthenticator, setAuthorizationGenerator, setAuthorizationGenerators, setAuthorizationGenerators, setCredentialsExtractor, setName, setProfileCreatorinit, reinitpublic static final String ERROR_PARAMETER
public static final String MISSING_FIELD_ERROR
public FormClient()
public FormClient(String loginUrl, Authenticator usernamePasswordAuthenticator)
public FormClient(String loginUrl, String usernameParameter, String passwordParameter, Authenticator usernamePasswordAuthenticator)
public FormClient(String loginUrl, Authenticator usernamePasswordAuthenticator, ProfileCreator profileCreator)
protected void clientInit(WebContext context)
clientInit in class IndirectClient<UsernamePasswordCredentials,CommonProfile>protected UsernamePasswordCredentials retrieveCredentials(WebContext context) throws HttpAction
retrieveCredentials in class BaseClient<UsernamePasswordCredentials,CommonProfile>HttpActionprotected HttpAction handleInvalidCredentials(WebContext context, String username, String message, String errorMessage) throws HttpAction
HttpActionprotected String computeErrorMessage(Exception 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 IndirectClient<UsernamePasswordCredentials,CommonProfile>Copyright © 2017. All Rights Reserved.