1 21 22 27 28 package javax.mail; 29 30 import java.net.InetAddress ; 31 32 60 61 public abstract class Authenticator { 64 65 private InetAddress requestingSite; 66 private int requestingPort; 67 private String requestingProtocol; 68 private String requestingPrompt; 69 private String requestingUserName; 70 71 private void reset() { 72 requestingSite = null; 73 requestingPort = -1; 74 requestingProtocol = null; 75 requestingPrompt = null; 76 requestingUserName = null; 77 } 78 79 92 final PasswordAuthentication requestPasswordAuthentication( 93 InetAddress addr, int port, String protocol, 94 String prompt, String defaultUserName) { 95 96 reset(); 97 requestingSite = addr; 98 requestingPort = port; 99 requestingProtocol = protocol; 100 requestingPrompt = prompt; 101 requestingUserName = defaultUserName; 102 return getPasswordAuthentication(); 103 } 104 105 109 protected final InetAddress getRequestingSite() { 110 return requestingSite; 111 } 112 113 116 protected final int getRequestingPort() { 117 return requestingPort; 118 } 119 120 128 protected final String getRequestingProtocol() { 129 return requestingProtocol; 130 } 131 132 135 protected final String getRequestingPrompt() { 136 return requestingPrompt; 137 } 138 139 142 protected final String getDefaultUserName() { 143 return requestingUserName; 144 } 145 146 157 protected PasswordAuthentication getPasswordAuthentication() { 158 return null; 159 } 160 } 161 | Popular Tags |