java.net.PasswordAuthentication Java Examples

The following examples show how to use java.net.PasswordAuthentication. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MavenWrapperDownloader.java    From intellij-quarkus with Eclipse Public License 2.0 6 votes vote down vote up
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
    if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
        String username = System.getenv("MVNW_USERNAME");
        char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(username, password);
            }
        });
    }
    URL website = new URL(urlString);
    ReadableByteChannel rbc;
    rbc = Channels.newChannel(website.openStream());
    FileOutputStream fos = new FileOutputStream(destination);
    fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
    fos.close();
    rbc.close();
}
 
Example #2
Source File: NTLMAuthentication.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void init (PasswordAuthentication pw) {
    this.pw = pw;
    if (pw != null) {
        String s = pw.getUserName();
        int i = s.indexOf ('\\');
        if (i == -1) {
            username = s;
            ntdomain = defaultDomain;
        } else {
            ntdomain = s.substring (0, i).toUpperCase();
            username = s.substring (i+1);
        }
        password = new String (pw.getPassword());
    } else {
        /* credentials will be acquired from OS */
        username = null;
        ntdomain = null;
        password = null;
    }
    init0();
}
 
Example #3
Source File: SvnClientExceptionHandler.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean handleKenaiAuthorization(SvnKenaiAccessor support, String url) {
    PasswordAuthentication pa = support.getPasswordAuthentication(url, true);
    if(pa == null) {
        return false;
    }

    String user = pa.getUserName();
    char[] password = pa.getPassword();
    
    adapter.setUsername(user != null ? user : "");
    if (connectionType != ConnectionType.javahl) {
        adapter.setPassword(password != null ? new String(password) : "");
    }

    return true;
}
 
Example #4
Source File: Proxy.java    From ripme with MIT License 6 votes vote down vote up
/**
 * Set a Socks Proxy Server (globally).
 *
 * @param fullsocks the socks server, using format [user:password]@host[:port]
 */
public static void setSocks(String fullsocks) {

    Map<String, String> socksServer = parseServer(fullsocks);
    if (socksServer.get("user") != null && socksServer.get("password") != null) {
        Authenticator.setDefault(new Authenticator(){
            protected PasswordAuthentication  getPasswordAuthentication(){
                PasswordAuthentication p = new PasswordAuthentication(socksServer.get("user"), socksServer.get("password").toCharArray());
                return p;
            }
        });
        System.setProperty("java.net.socks.username", socksServer.get("user"));
        System.setProperty("java.net.socks.password", socksServer.get("password"));
    }
    if (socksServer.get("port") != null) {
        System.setProperty("socksProxyPort", socksServer.get("port"));
    }

    System.setProperty("socksProxyHost", socksServer.get("server"));
}
 
Example #5
Source File: NegotiateCallbackHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void getAnswer() {
    if (!answered) {
        answered = true;

        if (LoginConfigImpl.HTTP_USE_GLOBAL_CREDS) {
            PasswordAuthentication passAuth =
                    Authenticator.requestPasswordAuthentication(
                            hci.host, hci.addr, hci.port, hci.protocol,
                            hci.prompt, hci.scheme, hci.url, hci.authType);
            /**
             * To be compatible with existing callback handler implementations,
             * when the underlying Authenticator is canceled, username and
             * password are assigned null. No exception is thrown.
             */
            if (passAuth != null) {
                username = passAuth.getUserName();
                password = passAuth.getPassword();
            }
        }
    }
}
 
Example #6
Source File: HttpURLConnection.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static PasswordAuthentication
privilegedRequestPasswordAuthentication(
                        final String host,
                        final InetAddress addr,
                        final int port,
                        final String protocol,
                        final String prompt,
                        final String scheme,
                        final URL url,
                        final RequestorType authType) {
    return java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction<PasswordAuthentication>() {
            public PasswordAuthentication run() {
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Requesting Authentication: host =" + host + " url = " + url);
                }
                PasswordAuthentication pass = Authenticator.requestPasswordAuthentication(
                    host, addr, port, protocol,
                    prompt, scheme, url, authType);
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                }
                return pass;
            }
        });
}
 
Example #7
Source File: Proxy.java    From ripme with MIT License 6 votes vote down vote up
/**
 * Set a HTTP Proxy.
 * WARNING: Authenticated HTTP Proxy won't work from jdk1.8.111 unless
 * passing the flag -Djdk.http.auth.tunneling.disabledSchemes="" to java
 * see https://stackoverflow.com/q/41505219
 *
 * @param fullproxy the proxy, using format [user:password]@host[:port]
 */
public static void setHTTPProxy(String fullproxy) {
    Map<String, String> proxyServer = parseServer(fullproxy);

    if (proxyServer.get("user") != null && proxyServer.get("password") != null) {
        Authenticator.setDefault(new Authenticator(){
            protected PasswordAuthentication  getPasswordAuthentication(){
                PasswordAuthentication p = new PasswordAuthentication(proxyServer.get("user"), proxyServer.get("password").toCharArray());
                return p;
            }
        });
        System.setProperty("http.proxyUser", proxyServer.get("user"));
        System.setProperty("http.proxyPassword", proxyServer.get("password"));
        System.setProperty("https.proxyUser", proxyServer.get("user"));
        System.setProperty("https.proxyPassword", proxyServer.get("password"));
    }

    if (proxyServer.get("port") != null) {
        System.setProperty("http.proxyPort", proxyServer.get("port"));
        System.setProperty("https.proxyPort", proxyServer.get("port"));
    }

    System.setProperty("http.proxyHost", proxyServer.get("server"));
    System.setProperty("https.proxyHost", proxyServer.get("server"));
}
 
Example #8
Source File: MavenWrapperDownloader.java    From intellij-quarkus with Eclipse Public License 2.0 6 votes vote down vote up
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
    if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
        String username = System.getenv("MVNW_USERNAME");
        char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(username, password);
            }
        });
    }
    URL website = new URL(urlString);
    ReadableByteChannel rbc;
    rbc = Channels.newChannel(website.openStream());
    FileOutputStream fos = new FileOutputStream(destination);
    fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
    fos.close();
    rbc.close();
}
 
Example #9
Source File: XDMApp.java    From xdm with GNU General Public License v2.0 6 votes vote down vote up
private PasswordAuthentication getCredential(String msg, boolean proxy) {
	JTextField user = new JTextField(30);
	JPasswordField pass = new JPasswordField(30);

	String prompt = proxy ? StringResource.get("PROMPT_PROXY")
			: String.format(StringResource.get("PROMPT_SERVER"), msg);

	Object[] obj = new Object[5];
	obj[0] = prompt;
	obj[1] = StringResource.get("DESC_USER");
	obj[2] = user;
	obj[3] = StringResource.get("DESC_PASS");
	obj[4] = pass;

	if (JOptionPane.showOptionDialog(null, obj, StringResource.get("PROMPT_CRED"), JOptionPane.OK_CANCEL_OPTION,
			JOptionPane.PLAIN_MESSAGE, null, null, null) == JOptionPane.OK_OPTION) {
		PasswordAuthentication pauth = new PasswordAuthentication(user.getText(), pass.getPassword());
		return pauth;
	}
	return null;
}
 
Example #10
Source File: NTLMAuthentication.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void init (PasswordAuthentication pw) {
    this.pw = pw;
    if (pw != null) {
        String s = pw.getUserName();
        int i = s.indexOf ('\\');
        if (i == -1) {
            username = s;
            ntdomain = defaultDomain;
        } else {
            ntdomain = s.substring (0, i).toUpperCase();
            username = s.substring (i+1);
        }
        password = new String (pw.getPassword());
    } else {
        /* credentials will be acquired from OS */
        username = null;
        ntdomain = null;
        password = null;
    }
    init0();
}
 
Example #11
Source File: Webi.java    From webi with Apache License 2.0 6 votes vote down vote up
public Webi setProxy(String host, int port, final String username, final String password) {
    webService.is_proxy_seted = true;
    webService.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
    System.setProperty("http.proxyHost", host);
    System.setProperty("http.proxyPort", String.valueOf(port));
    System.setProperty("http.proxyUser", username);
    System.setProperty("http.proxyPassword", password);

    Authenticator.setDefault(
            new Authenticator() {
                public PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication(username, password.toCharArray());
                }
            }
    );
    return this;
}
 
Example #12
Source File: HttpURLConnection.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static PasswordAuthentication
privilegedRequestPasswordAuthentication(
                        final String host,
                        final InetAddress addr,
                        final int port,
                        final String protocol,
                        final String prompt,
                        final String scheme,
                        final URL url,
                        final RequestorType authType) {
    return java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction<PasswordAuthentication>() {
            public PasswordAuthentication run() {
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Requesting Authentication: host =" + host + " url = " + url);
                }
                PasswordAuthentication pass = Authenticator.requestPasswordAuthentication(
                    host, addr, port, protocol,
                    prompt, scheme, url, authType);
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                }
                return pass;
            }
        });
}
 
Example #13
Source File: NTLMAuthenticationProxy.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Loads the NTLM authentiation implementation through reflection. If
 * the class is present, then it must have the required constructors and
 * method. Otherwise, it is considered an error.
 */
@SuppressWarnings("unchecked")
private static NTLMAuthenticationProxy tryLoadNTLMAuthentication() {
    Class<? extends AuthenticationInfo> cl;
    Constructor<? extends AuthenticationInfo> threeArg, fiveArg;
    try {
        cl = (Class<? extends AuthenticationInfo>)Class.forName(clazzStr, true, null);
        if (cl != null) {
            threeArg = cl.getConstructor(boolean.class,
                                         URL.class,
                                         PasswordAuthentication.class);
            fiveArg = cl.getConstructor(boolean.class,
                                        String.class,
                                        int.class,
                                        PasswordAuthentication.class);
            supportsTA = cl.getDeclaredMethod(supportsTAStr);
            isTrustedSite = cl.getDeclaredMethod(isTrustedSiteStr, java.net.URL.class);
            return new NTLMAuthenticationProxy(threeArg,
                                               fiveArg);
        }
    } catch (ClassNotFoundException cnfe) {
        finest(cnfe);
    } catch (ReflectiveOperationException roe) {
        throw new AssertionError(roe);
    }

    return null;
}
 
Example #14
Source File: NTLMAuthenticationProxy.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Loads the NTLM authentiation implementation through reflection. If
 * the class is present, then it must have the required constructors and
 * method. Otherwise, it is considered an error.
 */
@SuppressWarnings("unchecked")
private static NTLMAuthenticationProxy tryLoadNTLMAuthentication() {
    Class<? extends AuthenticationInfo> cl;
    Constructor<? extends AuthenticationInfo> threeArg, fiveArg;
    try {
        cl = (Class<? extends AuthenticationInfo>)Class.forName(clazzStr, true, null);
        if (cl != null) {
            threeArg = cl.getConstructor(boolean.class,
                                         URL.class,
                                         PasswordAuthentication.class);
            fiveArg = cl.getConstructor(boolean.class,
                                        String.class,
                                        int.class,
                                        PasswordAuthentication.class);
            supportsTA = cl.getDeclaredMethod(supportsTAStr);
            isTrustedSite = cl.getDeclaredMethod(isTrustedSiteStr, java.net.URL.class);
            return new NTLMAuthenticationProxy(threeArg,
                                               fiveArg);
        }
    } catch (ClassNotFoundException cnfe) {
        finest(cnfe);
    } catch (ReflectiveOperationException roe) {
        throw new AssertionError(roe);
    }

    return null;
}
 
Example #15
Source File: BatchPatternDialog.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
	String name = (e.getSource() instanceof JComponent) ? ((JComponent) e.getSource()).getName() : "";
	if ("RAD_NUM".equals(name)) {
		spFrom.setModel(spFromModelNum);
		spTo.setModel(spToModelNum);
		transparentSpinner(spTo);
		transparentSpinner(spFrom);
		makeUrls();
	} else if ("RAD_LETTER".equals(name)) {
		spFrom.setModel(spFromModelAlpha);
		spTo.setModel(spToModelAlpha);
		spTo.setValue("z");
		transparentSpinner(spTo);
		transparentSpinner(spFrom);
		makeUrls();
	} else if ("OK".equals(name)) {
		try {
			if (chkUseAuth.isSelected()) {
				String user = txtUser.getText();
				String pass = txtPass.getText();
				String host = new URL(txtUrl.getText()).getHost();
				CredentialManager.getInstance().addCredentialForHost(host,
						new PasswordAuthentication(user, pass.toCharArray()));
			}
			if (urls.size() > 0) {
				dispose();
				new BatchDownloadWnd(XDMUtils.toMetadata(urls)).setVisible(true);
			}
		} catch (Exception e2) {
			Logger.log(e2);
		}

	} else if ("CLOSE".equals(name)) {
		dispose();
	}
}
 
Example #16
Source File: BasicAuthentication.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static String authValueFrom(PasswordAuthentication pw, boolean isUTF8) {
    String plain = pw.getUserName() + ":";
    char[] password = pw.getPassword();
    CharBuffer cbuf = CharBuffer.allocate(plain.length() + password.length);
    cbuf.put(plain).put(password).flip();
    Charset charset = isUTF8 ? UTF_8.INSTANCE : ISO_8859_1.INSTANCE;
    ByteBuffer buf = charset.encode(cbuf);
    ByteBuffer enc = Base64.getEncoder().encode(buf);
    String ret = "Basic " + new String(enc.array(), enc.position(), enc.remaining(),
            ISO_8859_1.INSTANCE);
    Arrays.fill(buf.array(), (byte) 0);
    Arrays.fill(enc.array(), (byte) 0);
    Arrays.fill(cbuf.array(), (char) 0);
    return ret;
}
 
Example #17
Source File: AuthenticationInfo.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException
{
    s.defaultReadObject ();
    pw = new PasswordAuthentication (s1, s2.toCharArray());
    s1 = null; s2= null;
}
 
Example #18
Source File: AuthenticationFilter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private PasswordAuthentication getCredentials(String header,
                                              boolean proxy,
                                              HttpRequestImpl req)
    throws IOException
{
    HttpClientImpl client = exchange.client();
    java.net.Authenticator auth =
            client.authenticator()
                  .orElseThrow(() -> new IOException("No authenticator set"));
    URI uri = req.uri();
    HeaderParser parser = new HeaderParser(header);
    String authscheme = parser.findKey(0);

    String realm = parser.findValue("realm");
    java.net.Authenticator.RequestorType rtype = proxy ? PROXY : SERVER;

    // needs to be instance method in Authenticator
    return auth.requestPasswordAuthenticationInstance(uri.getHost(),
                                                      null,
                                                      uri.getPort(),
                                                      uri.getScheme(),
                                                      realm,
                                                      authscheme,
                                                      uri.toURL(),
                                                      rtype
    );
}
 
Example #19
Source File: HttpURLConnection.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static PasswordAuthentication
privilegedRequestPasswordAuthentication(
                        final String host,
                        final InetAddress addr,
                        final int port,
                        final String protocol,
                        final String prompt,
                        final String scheme,
                        final URL url,
                        final RequestorType authType) {
    return java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction<PasswordAuthentication>() {
            public PasswordAuthentication run() {
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Requesting Authentication: host =" + host + " url = " + url);
                }
                PasswordAuthentication pass = Authenticator.requestPasswordAuthentication(
                    host, addr, port, protocol,
                    prompt, scheme, url, authType);
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                }
                return pass;
            }
        });
}
 
Example #20
Source File: HttpsProxyStackOverflow.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static BadAuthProxyServer startServer() throws IOException {
    Authenticator.setDefault(new Authenticator() {
        @Override
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication("xyz", "xyz".toCharArray());
        }
        });

    BadAuthProxyServer server = new BadAuthProxyServer(new ServerSocket(0));
    Thread serverThread = new Thread(server);
    serverThread.start();
    return server;
}
 
Example #21
Source File: NTLMAuthenticationProxy.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
AuthenticationInfo create(boolean isProxy,
                          String host,
                          int port,
                          PasswordAuthentication pw) {
    try {
        return fiveArgCtr.newInstance(isProxy, host, port, pw);
    } catch (ReflectiveOperationException roe) {
        finest(roe);
    }

    return null;
}
 
Example #22
Source File: DigestAuthentication.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a DigestAuthentication
 */
public DigestAuthentication(boolean isProxy, URL url, String realm,
                            String authMethod, PasswordAuthentication pw,
                            Parameters params, String authenticatorKey) {
    super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
          AuthScheme.DIGEST,
          url,
          realm,
          Objects.requireNonNull(authenticatorKey));
    this.authMethod = authMethod;
    this.pw = pw;
    this.params = params;
}
 
Example #23
Source File: DigestAuthentication.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a DigestAuthentication
 */
public DigestAuthentication(boolean isProxy, URL url, String realm,
                            String authMethod, PasswordAuthentication pw,
                            Parameters params) {
    super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
          AuthScheme.DIGEST,
          url,
          realm);
    this.authMethod = authMethod;
    this.pw = pw;
    this.params = params;
}
 
Example #24
Source File: NTLMAuthenticationProxy.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
AuthenticationInfo create(boolean isProxy,
                          String host,
                          int port,
                          PasswordAuthentication pw) {
    try {
        return fiveArgCtr.newInstance(isProxy, host, port, pw);
    } catch (ReflectiveOperationException roe) {
        finest(roe);
    }

    return null;
}
 
Example #25
Source File: BasicAuthentication.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a BasicAuthentication
 */
public BasicAuthentication(boolean isProxy, String host, int port,
                           String realm, PasswordAuthentication pw) {
    super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
          AuthScheme.BASIC, host, port, realm);
    String plain = pw.getUserName() + ":";
    byte[] nameBytes = null;
    try {
        nameBytes = plain.getBytes("ISO-8859-1");
    } catch (java.io.UnsupportedEncodingException uee) {
        assert false;
    }

    // get password bytes
    char[] passwd = pw.getPassword();
    byte[] passwdBytes = new byte[passwd.length];
    for (int i=0; i<passwd.length; i++)
        passwdBytes[i] = (byte)passwd[i];

    // concatenate user name and password bytes and encode them
    byte[] concat = new byte[nameBytes.length + passwdBytes.length];
    System.arraycopy(nameBytes, 0, concat, 0, nameBytes.length);
    System.arraycopy(passwdBytes, 0, concat, nameBytes.length,
                     passwdBytes.length);
    this.auth = "Basic " + Base64.getEncoder().encodeToString(concat);
    this.pw = pw;
}
 
Example #26
Source File: DefaultAuthenticator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected PasswordAuthentication getPasswordAuthentication() {
    //If user sets proxy user and passwd and the RequestType is from proxy server then create
    // PasswordAuthentication using proxyUser and proxyPasswd;
    if ((getRequestorType() == RequestorType.PROXY) && proxyUser != null && proxyPasswd != null) {
        return new PasswordAuthentication(proxyUser, proxyPasswd.toCharArray());
    }
    for (AuthInfo auth : authInfo) {
        if (auth.matchingHost(getRequestingURL())) {
            return new PasswordAuthentication(auth.getUser(), auth.getPassword().toCharArray());
        }
    }
    return null;
}
 
Example #27
Source File: DigestAuthentication.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a DigestAuthentication
 */
public DigestAuthentication(boolean isProxy, URL url, String realm,
                            String authMethod, PasswordAuthentication pw,
                            Parameters params) {
    super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
          AuthScheme.DIGEST,
          url,
          realm);
    this.authMethod = authMethod;
    this.pw = pw;
    this.params = params;
}
 
Example #28
Source File: NTLMAuthentication.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a NTLMAuthentication:
 * Username may be specified as domain<BACKSLASH>username in the application Authenticator.
 * If this notation is not used, then the domain will be taken
 * from a system property: "http.auth.ntlm.domain".
 */
public NTLMAuthentication(boolean isProxy, URL url, PasswordAuthentication pw) {
    super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
          AuthScheme.NTLM,
          url,
          "");
    init (pw);
}
 
Example #29
Source File: BasicAuthentication.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Create a BasicAuthentication
 */
public BasicAuthentication(boolean isProxy, String host, int port,
                           String realm, PasswordAuthentication pw,
                           boolean isUTF8, String authenticatorKey) {
    super(isProxy ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
          AuthScheme.BASIC, host, port, realm,
          Objects.requireNonNull(authenticatorKey));
    this.auth = authValueFrom(pw, isUTF8);
    this.pw = pw;
}
 
Example #30
Source File: NTLMAuthenticationProxy.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
AuthenticationInfo create(boolean isProxy,
                          URL url,
                          PasswordAuthentication pw) {
    try {
        return threeArgCtr.newInstance(isProxy, url, pw);
    } catch (ReflectiveOperationException roe) {
        finest(roe);
    }

    return null;
}