1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 19:22:22 -05:00

Caldav: need to check session on each request, credentials may have changed or session expired

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@770 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-10-07 19:58:29 +00:00
parent db4b9d5a94
commit cb1efbe973

View File

@ -155,16 +155,12 @@ public class CaldavConnection extends AbstractConnection {
sendUnauthorized(); sendUnauthorized();
} else { } else {
decodeCredentials(headers.get("authorization")); decodeCredentials(headers.get("authorization"));
// authenticate only once, but check credentials // need to check session on each request, credentials may have changed or session expired
if (session == null || !session.checkCredentials(userName, password)) { try {
try { session = ExchangeSessionFactory.getInstance(userName, password);
session = ExchangeSessionFactory.getInstance(userName, password);
} catch (DavMailAuthenticationException e) {
sendUnauthorized();
}
}
if (session != null) {
handleRequest(command, path, headers, content); handleRequest(command, path, headers, content);
} catch (DavMailAuthenticationException e) {
sendUnauthorized();
} }
} }
@ -1322,7 +1318,7 @@ public class CaldavConnection extends AbstractConnection {
return session.buildCalendarPath(getPathElement(2), calendarPath.toString()); return session.buildCalendarPath(getPathElement(2), calendarPath.toString());
} else { } else {
StringBuilder calendarPath = new StringBuilder(); StringBuilder calendarPath = new StringBuilder();
for (int i=0;i<endIndex;i++) { for (int i = 0; i < endIndex; i++) {
calendarPath.append('/').append(getPathElement(i)); calendarPath.append('/').append(getPathElement(i));
} }
return calendarPath.toString(); return calendarPath.toString();