public class FormClient extends IndirectClientV2<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, callbackUrlResolver
logger
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 String |
computeErrorMessage(TechnicalException e)
Return the error message depending on the thrown exception.
|
String |
getLoginUrl() |
String |
getPasswordParameter() |
String |
getUsernameParameter() |
protected void |
internalInit(WebContext context)
Internal initialization of the object.
|
protected UsernamePasswordCredentials |
retrieveCredentials(WebContext context)
Retrieve the credentials.
|
void |
setLoginUrl(String loginUrl) |
void |
setPasswordParameter(String passwordParameter) |
void |
setUsernameParameter(String usernameParameter) |
String |
toString() |
assertAuthenticatorTypes, getAuthenticator, getCredentialsExtractor, getProfileCreator, getRedirectActionBuilder, retrieveRedirectAction, retrieveUserProfile, setAuthenticator, setCredentialsExtractor, setProfileCreator, setRedirectActionBuilder
computeFinalCallbackUrl, getAjaxRequestResolver, getCallbackUrl, getCallbackUrlResolver, getCredentials, getRedirectAction, 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 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 internalInit(WebContext context)
InitializableWebObject
internalInit
in class IndirectClientV2<UsernamePasswordCredentials,CommonProfile>
context
- the web contextprotected UsernamePasswordCredentials retrieveCredentials(WebContext context) throws HttpAction
IndirectClient
retrieveCredentials
in class IndirectClientV2<UsernamePasswordCredentials,CommonProfile>
context
- the web contextHttpAction
- whether an additional HTTP action is requiredprotected 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 IndirectClientV2<UsernamePasswordCredentials,CommonProfile>
Copyright © 2016. All rights reserved.