1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package davmail.http;
21
22 import org.apache.http.auth.AuthScheme;
23 import org.apache.http.auth.AuthSchemeFactory;
24 import org.apache.http.auth.AuthSchemeProvider;
25 import org.apache.http.params.HttpParams;
26 import org.apache.http.protocol.HttpContext;
27
28
29
30
31 public class DavMailSPNegoSchemeFactory implements AuthSchemeFactory, AuthSchemeProvider {
32
33 private final boolean stripPort;
34 private final boolean useCanonicalHostname;
35
36
37
38
39 public DavMailSPNegoSchemeFactory(final boolean stripPort, final boolean useCanonicalHostname) {
40 super();
41 this.stripPort = stripPort;
42 this.useCanonicalHostname = useCanonicalHostname;
43 }
44
45 public DavMailSPNegoSchemeFactory(final boolean stripPort) {
46 super();
47 this.stripPort = stripPort;
48 this.useCanonicalHostname = true;
49 }
50
51 public DavMailSPNegoSchemeFactory() {
52 this(true, true);
53 }
54
55 public boolean isStripPort() {
56 return stripPort;
57 }
58
59 public boolean isUseCanonicalHostname() {
60 return useCanonicalHostname;
61 }
62
63 @Override
64 public AuthScheme newInstance(final HttpParams params) {
65 return new DavMailSPNegoScheme(this.stripPort, this.useCanonicalHostname);
66 }
67
68 @Override
69 public AuthScheme create(final HttpContext context) {
70 return new DavMailSPNegoScheme(this.stripPort, this.useCanonicalHostname);
71 }
72
73 }