1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package javax.mail;
21
22 import java.net.InetAddress;
23
24
25
26
27 public abstract class Authenticator {
28 private InetAddress host;
29 private int port;
30 private String prompt;
31 private String protocol;
32 private String username;
33
34 synchronized PasswordAuthentication authenticate(InetAddress host, int port, String protocol, String prompt, String username) {
35 this.host = host;
36 this.port = port;
37 this.protocol = protocol;
38 this.prompt = prompt;
39 this.username = username;
40 return getPasswordAuthentication();
41 }
42
43 protected final String getDefaultUserName() {
44 return username;
45 }
46
47 protected PasswordAuthentication getPasswordAuthentication() {
48 return null;
49 }
50
51 protected final int getRequestingPort() {
52 return port;
53 }
54
55 protected final String getRequestingPrompt() {
56 return prompt;
57 }
58
59 protected final String getRequestingProtocol() {
60 return protocol;
61 }
62
63 protected final InetAddress getRequestingSite() {
64 return host;
65 }
66 }