mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 19:22:22 -05:00
Caldav: check credentials on each request
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@728 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
332ff6db99
commit
4a175cbe82
@ -155,8 +155,8 @@ public class CaldavConnection extends AbstractConnection {
|
|||||||
sendUnauthorized();
|
sendUnauthorized();
|
||||||
} else {
|
} else {
|
||||||
decodeCredentials(headers.get("authorization"));
|
decodeCredentials(headers.get("authorization"));
|
||||||
// authenticate only once
|
// authenticate only once, but check credentials
|
||||||
if (session == null) {
|
if (session == null || !session.checkCredentials(userName, password)) {
|
||||||
try {
|
try {
|
||||||
session = ExchangeSessionFactory.getInstance(userName, password);
|
session = ExchangeSessionFactory.getInstance(userName, password);
|
||||||
} catch (DavMailAuthenticationException e) {
|
} catch (DavMailAuthenticationException e) {
|
||||||
|
@ -263,6 +263,18 @@ public class ExchangeSession {
|
|||||||
return isExpired;
|
return isExpired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare credentials to current session credentials.
|
||||||
|
*
|
||||||
|
* @param userName user name
|
||||||
|
* @param password user password
|
||||||
|
* @return true if credentials match
|
||||||
|
*/
|
||||||
|
public boolean checkCredentials(String userName, String password) {
|
||||||
|
return userName != null && password != null
|
||||||
|
&& userName.equals(poolKey.userName) && password.equals(poolKey.password);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test authentication mode : form based or basic.
|
* Test authentication mode : form based or basic.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user