1 19 20 package org.netbeans.core; 21 22 import java.util.logging.Level ; 23 import java.util.logging.Logger ; 24 import java.util.prefs.Preferences ; 25 import org.openide.util.NbPreferences; 26 27 31 32 class NbAuthenticator extends java.net.Authenticator { 33 NbAuthenticator () { 34 Preferences proxySettingsNode = NbPreferences.root ().node ("/org/netbeans/core"); 35 assert proxySettingsNode != null; 36 } 37 38 protected java.net.PasswordAuthentication getPasswordAuthentication() { 39 Logger.getLogger (NbAuthenticator.class.getName ()).log (Level.FINER, "Authenticator.getPasswordAuthentication() with prompt " + this.getRequestingPrompt()); 40 41 if (ProxySettings.useAuthentication ()) { 42 Logger.getLogger (NbAuthenticator.class.getName ()).log (Level.FINER, "Username set to " + ProxySettings.getAuthenticationUsername () + " while request " + this.getRequestingURL ()); 43 return new java.net.PasswordAuthentication (ProxySettings.getAuthenticationUsername (), ProxySettings.getAuthenticationPassword ()); 44 } else { 45 Logger.getLogger (NbAuthenticator.class.getName ()).log (Level.WARNING, "No authentication set while requesting " + this.getRequestingURL ()); 46 return null; 47 } 48 49 } 50 } 51 | Popular Tags |