public class ExchangeFormAuthenticator extends Object implements ExchangeAuthenticator
Modifier and Type | Field and Description |
---|---|
protected static org.apache.log4j.Logger |
LOGGER |
protected static Set<String> |
PASSWORD_FIELDS
Various password fields found on custom Exchange authentication forms
|
protected static Set<String> |
TOKEN_FIELDS
Various OTP (one time password) fields found on custom Exchange authentication forms.
|
protected static Set<String> |
USER_NAME_FIELDS
Various username fields found on custom Exchange authentication forms
|
Constructor and Description |
---|
ExchangeFormAuthenticator() |
Modifier and Type | Method and Description |
---|---|
void |
authenticate()
Authenticate against Exchange or O365
|
protected PostRequest |
buildLogonMethod(HttpClientAdapter httpClient,
ResponseWrapper responseWrapper)
Try to find logon method path from logon form body.
|
protected void |
checkFormLoginQueryString(ResponseWrapper logonMethod) |
void |
close()
Close session.
|
protected void |
formLogin(HttpClientAdapter httpClient,
ResponseWrapper initRequest,
String password) |
protected URI |
getAbsoluteUri(URI uri,
String path) |
String |
getAliasFromLogin()
Get current Exchange alias name from login name
|
URI |
getExchangeUri()
Base Exchange URL.
|
HttpClientAdapter |
getHttpClientAdapter()
Return authenticated HttpClient 4 HttpClientAdapter
|
protected URI |
getScriptBasedFormURL(URI uri,
String pathQuery) |
O365Token |
getToken()
Oauth token.
|
String |
getUsername()
Actual username.
|
protected boolean |
isAuthenticated(ResponseWrapper getRequest)
Look for session cookies.
|
protected boolean |
isHttpAuthentication(HttpClientAdapter httpClient,
String url)
Test authentication mode : form based or basic.
|
protected ResponseWrapper |
postLogonMethod(HttpClientAdapter httpClient,
PostRequest logonMethod,
String password) |
protected void |
setAuthFormFields(org.apache.http.client.methods.HttpRequestBase logonMethod,
HttpClientAdapter httpClient,
String password) |
void |
setPassword(String password) |
void |
setUrl(String url) |
void |
setUsername(String username) |
protected ResponseWrapper |
submitLanguageSelectionForm(URI uri,
String responseBodyAsString) |
protected void |
throwAuthenticationFailed() |
protected static final org.apache.log4j.Logger LOGGER
protected static final Set<String> USER_NAME_FIELDS
protected static final Set<String> PASSWORD_FIELDS
public void setUsername(String username)
setUsername
in interface ExchangeAuthenticator
public void setPassword(String password)
setPassword
in interface ExchangeAuthenticator
public void setUrl(String url)
public void authenticate() throws DavMailException
ExchangeAuthenticator
authenticate
in interface ExchangeAuthenticator
DavMailException
protected boolean isHttpAuthentication(HttpClientAdapter httpClient, String url)
url
- exchange base URLhttpClient
- httpClientAdapter instanceprotected boolean isAuthenticated(ResponseWrapper getRequest)
protected void formLogin(HttpClientAdapter httpClient, ResponseWrapper initRequest, String password) throws IOException
IOException
protected PostRequest buildLogonMethod(HttpClientAdapter httpClient, ResponseWrapper responseWrapper)
httpClient
- httpClientAdapter instanceresponseWrapper
- init request response wrapperprotected ResponseWrapper postLogonMethod(HttpClientAdapter httpClient, PostRequest logonMethod, String password) throws IOException
IOException
protected ResponseWrapper submitLanguageSelectionForm(URI uri, String responseBodyAsString) throws IOException
IOException
protected void setAuthFormFields(org.apache.http.client.methods.HttpRequestBase logonMethod, HttpClientAdapter httpClient, String password) throws IllegalArgumentException
IllegalArgumentException
protected URI getAbsoluteUri(URI uri, String path) throws URISyntaxException
URISyntaxException
protected URI getScriptBasedFormURL(URI uri, String pathQuery) throws URISyntaxException, IOException
URISyntaxException
IOException
protected void checkFormLoginQueryString(ResponseWrapper logonMethod) throws DavMailAuthenticationException
DavMailAuthenticationException
protected void throwAuthenticationFailed() throws DavMailAuthenticationException
DavMailAuthenticationException
public String getAliasFromLogin()
public void close()
public O365Token getToken()
getToken
in interface ExchangeAuthenticator
public URI getExchangeUri()
getExchangeUri
in interface ExchangeAuthenticator
public HttpClientAdapter getHttpClientAdapter()
getHttpClientAdapter
in interface ExchangeAuthenticator
public String getUsername()
Copyright © 2001–2024 MickaĆ«l Guessant. All rights reserved.