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 ExchangeAuthenticatorpublic void setPassword(String password)
setPassword in interface ExchangeAuthenticatorpublic void setUrl(String url)
public void authenticate()
throws DavMailException
ExchangeAuthenticatorauthenticate in interface ExchangeAuthenticatorDavMailExceptionprotected 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
IOExceptionprotected PostRequest buildLogonMethod(HttpClientAdapter httpClient, ResponseWrapper responseWrapper)
httpClient - httpClientAdapter instanceresponseWrapper - init request response wrapperprotected ResponseWrapper postLogonMethod(HttpClientAdapter httpClient, PostRequest logonMethod, String password) throws IOException
IOExceptionprotected ResponseWrapper submitLanguageSelectionForm(URI uri, String responseBodyAsString) throws IOException
IOExceptionprotected void setAuthFormFields(org.apache.http.client.methods.HttpRequestBase logonMethod,
HttpClientAdapter httpClient,
String password)
throws IllegalArgumentException
IllegalArgumentExceptionprotected URI getAbsoluteUri(URI uri, String path) throws URISyntaxException
URISyntaxExceptionprotected URI getScriptBasedFormURL(URI uri, String pathQuery) throws URISyntaxException, IOException
URISyntaxExceptionIOExceptionprotected void checkFormLoginQueryString(ResponseWrapper logonMethod) throws DavMailAuthenticationException
DavMailAuthenticationExceptionprotected void throwAuthenticationFailed()
throws DavMailAuthenticationException
DavMailAuthenticationExceptionpublic String getAliasFromLogin()
public void close()
public O365Token getToken()
getToken in interface ExchangeAuthenticatorpublic URI getExchangeUri()
getExchangeUri in interface ExchangeAuthenticatorpublic HttpClientAdapter getHttpClientAdapter()
getHttpClientAdapter in interface ExchangeAuthenticatorpublic String getUsername()
Copyright © 2001–2025 MickaĆ«l Guessant. All rights reserved.