- Timestamp:
- 2008-10-28T19:04:39+13:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/GAuthenticator.java
r17551 r17621 68 68 /** The default size of this dialog. */ 69 69 static final private Dimension SIZE = new Dimension(470,160); 70 70 71 /** For Wget downloads, we want to avoid the second automatic request for proxy authentication 72 * But the settings for that specific case will otherwise interfere with how this GAuthenticator 73 * is to function in the usual situation. For this reason, we use two modes.*/ 74 static final public int REGULAR = 0; 75 static final public int DOWNLOAD = 1; 76 static private int operationMode = REGULAR; 77 78 public static void setMode(int mode) { 79 operationMode = mode; 80 } 81 71 82 /** Constructor. */ 72 83 public GAuthenticator() { … … 79 90 */ 80 91 protected PasswordAuthentication getPasswordAuthentication(String username_str, String password_str) { 81 82 // Don't prompt if the details were already saved for the same host and port. This is necessary 83 // when running wget because wget requires proxy authentication. And without the following, the 84 // regular proxy authentication would also popup a dialog requesting the same information. 85 86 String key = getRequestingHost() + ":" + getRequestingPort(); 87 String value = (String)authentications.get(key); 88 89 if(value != null) { // authentication for this host and port was already stored 90 // Arguments may be null. If so, retrieve them from the stored value 91 if(username_str == null) { 92 username_str = value.substring(0, value.indexOf("@")); 93 } 94 if(password_str == null) { 95 password_str = value.substring(value.indexOf("@") + 1); 92 if(operationMode == DOWNLOAD) { // special handling of proxy authentication popup for Wget downloads 93 94 // Don't prompt if the details were already saved for the same host and port. This is necessary 95 // when running wget because wget requires proxy authentication. And without the following, the 96 // regular proxy authentication would also popup a dialog requesting the same information. 97 98 String key = getRequestingHost() + ":" + getRequestingPort(); 99 String value = (String)authentications.get(key); 100 101 if(value != null) { // authentication for this host and port was already stored 102 // Arguments may be null. If so, retrieve them from the stored value 103 if(username_str == null) { 104 username_str = value.substring(0, value.indexOf("@")); 105 } 106 if(password_str == null) { 107 password_str = value.substring(value.indexOf("@") + 1); 108 } 109 return new PasswordAuthentication(username_str, password_str.toCharArray()); 96 110 } 97 return new PasswordAuthentication(username_str, password_str.toCharArray());98 111 } 99 112
Note:
See TracChangeset
for help on using the changeset viewer.