mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 19:22:22 -05:00
fix 2995990: Add support for already authenticated users
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1382 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
bd6bf0b395
commit
e06427d4e8
@ -155,18 +155,20 @@ public abstract class ExchangeSession {
|
||||
// manually follow redirect
|
||||
HttpMethod method = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, url);
|
||||
|
||||
if (isBasicAuthentication) {
|
||||
int status = method.getStatusCode();
|
||||
if (!this.isAuthenticated()) {
|
||||
if (isBasicAuthentication) {
|
||||
int status = method.getStatusCode();
|
||||
|
||||
if (status == HttpStatus.SC_UNAUTHORIZED) {
|
||||
method.releaseConnection();
|
||||
throw new DavMailAuthenticationException("EXCEPTION_AUTHENTICATION_FAILED");
|
||||
} else if (status != HttpStatus.SC_OK) {
|
||||
method.releaseConnection();
|
||||
throw DavGatewayHttpClientFacade.buildHttpException(method);
|
||||
if (status == HttpStatus.SC_UNAUTHORIZED) {
|
||||
method.releaseConnection();
|
||||
throw new DavMailAuthenticationException("EXCEPTION_AUTHENTICATION_FAILED");
|
||||
} else if (status != HttpStatus.SC_OK) {
|
||||
method.releaseConnection();
|
||||
throw DavGatewayHttpClientFacade.buildHttpException(method);
|
||||
}
|
||||
} else {
|
||||
method = formLogin(httpClient, method, userName, password);
|
||||
}
|
||||
} else {
|
||||
method = formLogin(httpClient, method, userName, password);
|
||||
}
|
||||
|
||||
// avoid 401 roundtrips, only if NTLM is disabled
|
||||
@ -422,7 +424,7 @@ public abstract class ExchangeSession {
|
||||
|
||||
HttpMethod logonMethod = buildLogonMethod(httpClient, initmethod);
|
||||
if (logonMethod == null) {
|
||||
LOGGER.debug("Authentication form not found at " + initmethod.getURI()+ ", trying default url");
|
||||
LOGGER.debug("Authentication form not found at " + initmethod.getURI() + ", trying default url");
|
||||
logonMethod = new PostMethod("/owa/auth/owaauth.dll");
|
||||
}
|
||||
|
||||
@ -1976,7 +1978,7 @@ public abstract class ExchangeSession {
|
||||
}
|
||||
|
||||
protected HttpException buildHttpException(Exception e) {
|
||||
String message = "Unable to get event " + getName() + " subject: "+subject+" at " + permanentUrl + ": " + e.getMessage();
|
||||
String message = "Unable to get event " + getName() + " subject: " + subject + " at " + permanentUrl + ": " + e.getMessage();
|
||||
LOGGER.warn(message);
|
||||
return new HttpException(message);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user