NetworkSettings.getAuthenticationPassword
added+ The SPI + NetworkSettings.ProxyCredentialsProvider allows NetBeans Platform + users to provide proxy and network credentials, but it should do so also for + the password, not only username. +
+password
for Proxy Authentication.
+ * Returns null
if no authentication required.
+ *
+ * @param u The URI that a connection is required to
+ * @return password for Proxy Authentication
+ * @since 9.8
+ */
+ public static char[] getAuthenticationPassword(URI u) {
+ ProxyCredentialsProvider provider = Lookup.getDefault().lookup(ProxyCredentialsProvider.class);
+ if (provider == null) {
+ LOGGER.log(Level.WARNING, "No ProxyCredentialsProvider found in lookup {0} thus no proxy information will provide!", Lookup.getDefault());
+ }
+ if (provider != null && provider.isProxyAuthentication(u)) {
+ return provider.getProxyPassword(u);
+ }
+ return null;
+ }
+
/** Returns the key
for reading password for Proxy Authentication.
* Use org.netbeans.api.keyring.Keyring
for reading the password from the ring.
* Returns null
if no authentication required.
*
* @param u The URI that a connection is required to
* @return the key for reading password for Proxy Authentication from the ring or null
+ * @deprecated use {@link #getAuthenticationPassword(java.net.URI)} instead
*/
public static String getKeyForAuthenticationPassword(URI u) {
ProxyCredentialsProvider provider = Lookup.getDefault().lookup(ProxyCredentialsProvider.class);