1 /*
2 * DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
3 * Copyright (C) 2010 Mickael Guessant
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20 package davmail.exchange.auth;
21
22 import davmail.http.HttpClientAdapter;
23
24 import java.io.IOException;
25 import java.net.URI;
26
27 /**
28 * Common interface for all Exchange and O365 authenticators.
29 * Implement this interface to build custom authenticators for unsupported Exchange architecture
30 */
31 public interface ExchangeAuthenticator {
32 void setUsername(String username);
33
34 void setPassword(String password);
35
36 /**
37 * Authenticate against Exchange or O365
38 * @throws IOException on error
39 */
40 void authenticate() throws IOException;
41
42 O365Token getToken() throws IOException;
43
44 /**
45 * Return default or computed Exchange or O365 url
46 * @return target url
47 */
48 URI getExchangeUri();
49
50 /**
51 * Return a new HttpClientAdapter instance with pooling enabled for ExchangeSession
52 * @return HttpClientAdapter instance
53 */
54 HttpClientAdapter getHttpClientAdapter();
55 }