mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 03:32:22 -05:00
Custom form (txtUserName, tstUserPass) support
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@706 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
4ace24e406
commit
b36085f241
@ -146,6 +146,15 @@ public class ExchangeSession {
|
|||||||
private static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
private static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||||
private static final String YYYY_MM_DD_T_HHMMSS_SSS_Z = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
private static final String YYYY_MM_DD_T_HHMMSS_SSS_Z = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logon form user name field, default is username.
|
||||||
|
*/
|
||||||
|
private String userNameInput = "username";
|
||||||
|
/**
|
||||||
|
* Logon form password field, default is password.
|
||||||
|
*/
|
||||||
|
private String passwordInput = "password";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an exchange session for the given URL.
|
* Create an exchange session for the given URL.
|
||||||
* The session is not actually established until a call to login()
|
* The session is not actually established until a call to login()
|
||||||
@ -317,6 +326,12 @@ public class ExchangeSession {
|
|||||||
if ("hidden".equalsIgnoreCase(type) && name != null && value != null) {
|
if ("hidden".equalsIgnoreCase(type) && name != null && value != null) {
|
||||||
logonMethod.addParameter(name, value);
|
logonMethod.addParameter(name, value);
|
||||||
}
|
}
|
||||||
|
// custom login form
|
||||||
|
if ("txtUserName".equals(name)) {
|
||||||
|
userNameInput = "txtUserName";
|
||||||
|
} else if ("txtUserPass".equals(name)) {
|
||||||
|
passwordInput = "txtUserPass";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List frameList = node.getElementListByName("frame", true);
|
List frameList = node.getElementListByName("frame", true);
|
||||||
@ -395,8 +410,8 @@ public class ExchangeSession {
|
|||||||
LOGGER.debug("Form based authentication detected");
|
LOGGER.debug("Form based authentication detected");
|
||||||
|
|
||||||
HttpMethod logonMethod = buildLogonMethod(httpClient, initmethod);
|
HttpMethod logonMethod = buildLogonMethod(httpClient, initmethod);
|
||||||
((PostMethod) logonMethod).addParameter("username", userName);
|
((PostMethod) logonMethod).addParameter(userNameInput, userName);
|
||||||
((PostMethod) logonMethod).addParameter("password", password);
|
((PostMethod) logonMethod).addParameter(passwordInput, password);
|
||||||
((PostMethod) logonMethod).addParameter("trusted", "4");
|
((PostMethod) logonMethod).addParameter("trusted", "4");
|
||||||
logonMethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, logonMethod);
|
logonMethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, logonMethod);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user