1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-02-28 17:31:52 -05:00

Workaround for NTLM authentication only on /public

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@977 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-03-30 20:46:57 +00:00
parent adf3bfaaf4
commit b03db2e42d
2 changed files with 15 additions and 3 deletions

View File

@ -667,7 +667,15 @@ public class ExchangeSession {
publicFolderUrl = publicUri.getURI(); publicFolderUrl = publicUri.getURI();
} }
PropFindMethod propFindMethod = new PropFindMethod(publicFolderUrl, CONTENT_TAG, 0); PropFindMethod propFindMethod = new PropFindMethod(publicFolderUrl, CONTENT_TAG, 0);
DavGatewayHttpClientFacade.executeMethod(httpClient, propFindMethod); try {
DavGatewayHttpClientFacade.executeMethod(httpClient, propFindMethod);
} catch (IOException e) {
// workaround for NTLM authentication only on /public
if (!DavGatewayHttpClientFacade.hasNTLM(httpClient)) {
DavGatewayHttpClientFacade.addNTLM(httpClient);
DavGatewayHttpClientFacade.executeMethod(httpClient, propFindMethod);
}
}
// update public folder URI // update public folder URI
publicFolderUrl = propFindMethod.getURI().getURI(); publicFolderUrl = propFindMethod.getURI().getURI();
} catch (IOException e) { } catch (IOException e) {
@ -2495,7 +2503,7 @@ public class ExchangeSession {
String searchQuery = "Select \"DAV:getetag\", \"http://schemas.microsoft.com/exchange/permanenturl\", \"urn:schemas:calendar:instancetype\"" + String searchQuery = "Select \"DAV:getetag\", \"http://schemas.microsoft.com/exchange/permanenturl\", \"urn:schemas:calendar:instancetype\"" +
" FROM Scope('SHALLOW TRAVERSAL OF \"" + folderPath + "\"')\n" + " FROM Scope('SHALLOW TRAVERSAL OF \"" + folderPath + "\"')\n" +
" WHERE \"DAV:contentclass\" = 'urn:content-classes:calendarmessage'\n" + " WHERE \"DAV:contentclass\" = 'urn:content-classes:calendarmessage'\n" +
" AND (\""+scheduleStatePropertyName+"\" IS NULL OR NOT \"" + scheduleStatePropertyName + "\" = 'CALDAV:schedule-processed')\n" + " AND (\"" + scheduleStatePropertyName + "\" IS NULL OR NOT \"" + scheduleStatePropertyName + "\" = 'CALDAV:schedule-processed')\n" +
" ORDER BY \"urn:schemas:calendar:dtstart\" DESC\n"; " ORDER BY \"urn:schemas:calendar:dtstart\" DESC\n";
result = getEvents(folderPath, searchQuery); result = getEvents(folderPath, searchQuery);
} catch (HttpException e) { } catch (HttpException e) {

View File

@ -404,7 +404,11 @@ public final class DavGatewayHttpClientFacade {
return authPrefs == null || (authPrefs instanceof List<?> && ((Collection) authPrefs).contains(AuthPolicy.NTLM)); return authPrefs == null || (authPrefs instanceof List<?> && ((Collection) authPrefs).contains(AuthPolicy.NTLM));
} }
private static void addNTLM(HttpClient httpClient) { /**
* Enable NTLM authentication on http client
* @param httpClient HttpClient instance
*/
public static void addNTLM(HttpClient httpClient) {
ArrayList<String> authPrefs = new ArrayList<String>(); ArrayList<String> authPrefs = new ArrayList<String>();
authPrefs.add(AuthPolicy.NTLM); authPrefs.add(AuthPolicy.NTLM);
authPrefs.add(AuthPolicy.DIGEST); authPrefs.add(AuthPolicy.DIGEST);