Changeset 17551

Show
Ignore:
Timestamp:
16.10.2008 17:23:22 (11 years ago)
Author:
ak19
Message:

Authenticator now only prompts for proxy details for WGet and no longer pops up a second dialog requesting the same proxy authentication information for the general proxy.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/GAuthenticator.java

    r14974 r17551  
    7979     */ 
    8080    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); 
     96        } 
     97        return new PasswordAuthentication(username_str, password_str.toCharArray()); 
     98    } 
     99     
    81100    // Component definition. 
    82101    dialog = new JDialog (Gatherer.g_man, Dictionary.get("GAuthenticator.Title"), true);