java类java.net.Authenticator.RequestorType的实例源码

HttpURLConnection.java 文件源码 项目:OpenJSharp 阅读 24 收藏 0 点赞 0 评论 0
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;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:OpenJSharp 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
AuthenticatorAdapter.java 文件源码 项目:boohee_v5.6 阅读 21 收藏 0 点赞 0 评论 0
public Request authenticate(Proxy proxy, Response response) throws IOException {
    List<Challenge> challenges = response.challenges();
    Request request = response.request();
    HttpUrl url = request.httpUrl();
    int size = challenges.size();
    for (int i = 0; i < size; i++) {
        Challenge challenge = (Challenge) challenges.get(i);
        if ("Basic".equalsIgnoreCase(challenge.getScheme())) {
            PasswordAuthentication auth = java.net.Authenticator
                    .requestPasswordAuthentication(url.host(), getConnectToInetAddress(proxy,
                            url), url.port(), url.scheme(), challenge.getRealm(), challenge
                            .getScheme(), url.url(), RequestorType.SERVER);
            if (auth != null) {
                return request.newBuilder().header("Authorization", Credentials.basic(auth
                        .getUserName(), new String(auth.getPassword()))).build();
            }
        }
    }
    return null;
}
AuthenticatorAdapter.java 文件源码 项目:boohee_v5.6 阅读 33 收藏 0 点赞 0 评论 0
public Request authenticateProxy(Proxy proxy, Response response) throws IOException {
    List<Challenge> challenges = response.challenges();
    Request request = response.request();
    HttpUrl url = request.httpUrl();
    int size = challenges.size();
    for (int i = 0; i < size; i++) {
        Challenge challenge = (Challenge) challenges.get(i);
        if ("Basic".equalsIgnoreCase(challenge.getScheme())) {
            InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address();
            PasswordAuthentication auth = java.net.Authenticator
                    .requestPasswordAuthentication(proxyAddress.getHostName(),
                            getConnectToInetAddress(proxy, url), proxyAddress.getPort(), url
                                    .scheme(), challenge.getRealm(), challenge.getScheme(),
                            url.url(), RequestorType.PROXY);
            if (auth != null) {
                return request.newBuilder().header("Proxy-Authorization", Credentials.basic
                        (auth.getUserName(), new String(auth.getPassword()))).build();
            }
        }
    }
    return null;
}
HttpURLConnection.java 文件源码 项目:jdk8u-jdk 阅读 20 收藏 0 点赞 0 评论 0
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;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:jdk8u-jdk 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
HttpCallerInfo.java 文件源码 项目:openjdk-jdk10 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url, Authenticator a) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
    authenticator = a;
}
HttpURLConnection.java 文件源码 项目:silvertunnel-ng 阅读 38 收藏 0 点赞 0 评论 0
/**
 * privileged request password authentication.
 */
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>() {
        @Override
        public PasswordAuthentication run() {
            return Authenticator.requestPasswordAuthentication(
                    host, addr, port, protocol, prompt, scheme,
                    url, authType);
        }
    });
}
HttpURLConnection.java 文件源码 项目:openjdk9 阅读 27 收藏 0 点赞 0 评论 0
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<>() {
            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;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:openjdk9 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
HttpURLConnection.java 文件源码 项目:jdk8u_jdk 阅读 29 收藏 0 点赞 0 评论 0
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;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:jdk8u_jdk 阅读 15 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
HttpURLConnection.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 27 收藏 0 点赞 0 评论 0
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;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
AuthenticatorAdapter.java 文件源码 项目:FMTech 阅读 27 收藏 0 点赞 0 评论 0
public final Request authenticate(Proxy paramProxy, Response paramResponse)
  throws IOException
{
  List localList = paramResponse.challenges();
  Request localRequest = paramResponse.request;
  URL localURL = localRequest.url();
  int i = 0;
  int j = localList.size();
  while (i < j)
  {
    Challenge localChallenge = (Challenge)localList.get(i);
    if ("Basic".equalsIgnoreCase(localChallenge.scheme))
    {
      PasswordAuthentication localPasswordAuthentication = java.net.Authenticator.requestPasswordAuthentication(localURL.getHost(), getConnectToInetAddress(paramProxy, localURL), localURL.getPort(), localURL.getProtocol(), localChallenge.realm, localChallenge.scheme, localURL, Authenticator.RequestorType.SERVER);
      if (localPasswordAuthentication != null)
      {
        String str = Credentials.basic(localPasswordAuthentication.getUserName(), new String(localPasswordAuthentication.getPassword()));
        return localRequest.newBuilder().header("Authorization", str).build();
      }
    }
    i++;
  }
  return null;
}
AuthenticatorAdapter.java 文件源码 项目:FMTech 阅读 31 收藏 0 点赞 0 评论 0
public final Request authenticateProxy(Proxy paramProxy, Response paramResponse)
  throws IOException
{
  List localList = paramResponse.challenges();
  Request localRequest = paramResponse.request;
  URL localURL = localRequest.url();
  int i = 0;
  int j = localList.size();
  while (i < j)
  {
    Challenge localChallenge = (Challenge)localList.get(i);
    if ("Basic".equalsIgnoreCase(localChallenge.scheme))
    {
      InetSocketAddress localInetSocketAddress = (InetSocketAddress)paramProxy.address();
      PasswordAuthentication localPasswordAuthentication = java.net.Authenticator.requestPasswordAuthentication(localInetSocketAddress.getHostName(), getConnectToInetAddress(paramProxy, localURL), localInetSocketAddress.getPort(), localURL.getProtocol(), localChallenge.realm, localChallenge.scheme, localURL, Authenticator.RequestorType.PROXY);
      if (localPasswordAuthentication != null)
      {
        String str = Credentials.basic(localPasswordAuthentication.getUserName(), new String(localPasswordAuthentication.getPassword()));
        return localRequest.newBuilder().header("Proxy-Authorization", str).build();
      }
    }
    i++;
  }
  return null;
}
HttpURLConnection.java 文件源码 项目:silvertunnel-monteux 阅读 23 收藏 0 点赞 0 评论 0
/**
 * privileged request password authentication.
 */
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>()
            {
                @Override
                public PasswordAuthentication run()
                {
                    return Authenticator.requestPasswordAuthentication(
                            host, addr, port, protocol, prompt, scheme,
                            url, authType);
                }
            });
}
HttpURLConnection.java 文件源码 项目:infobip-open-jdk-8 阅读 34 收藏 0 点赞 0 评论 0
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;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:infobip-open-jdk-8 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
HttpURLConnection.java 文件源码 项目:jdk8u-dev-jdk 阅读 23 收藏 0 点赞 0 评论 0
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;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:jdk8u-dev-jdk 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
HttpURLConnection.java 文件源码 项目:jdk7-jdk 阅读 38 收藏 0 点赞 0 评论 0
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.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.FINEST)) {
                    logger.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                }
                return pass;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:jdk7-jdk 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
AuthenticatorAdapter.java 文件源码 项目:spdymcsclient 阅读 26 收藏 0 点赞 0 评论 0
@Override public Request authenticate(Proxy proxy, Response response) throws IOException {
  List<Challenge> challenges = response.challenges();
  Request request = response.request();
  URL url = request.url();
  for (int i = 0, size = challenges.size(); i < size; i++) {
    Challenge challenge = challenges.get(i);
    if (!"Basic".equalsIgnoreCase(challenge.getScheme())) continue;

    PasswordAuthentication auth = java.net.Authenticator.requestPasswordAuthentication(
        url.getHost(), getConnectToInetAddress(proxy, url), url.getPort(), url.getProtocol(),
        challenge.getRealm(), challenge.getScheme(), url, RequestorType.SERVER);
    if (auth == null) continue;

    String credential = Credentials.basic(auth.getUserName(), new String(auth.getPassword()));
    return request.newBuilder()
        .header("Authorization", credential)
        .build();
  }
  return null;

}
AuthenticatorAdapter.java 文件源码 项目:spdymcsclient 阅读 25 收藏 0 点赞 0 评论 0
@Override public Request authenticateProxy(Proxy proxy, Response response) throws IOException {
  List<Challenge> challenges = response.challenges();
  Request request = response.request();
  URL url = request.url();
  for (int i = 0, size = challenges.size(); i < size; i++) {
    Challenge challenge = challenges.get(i);
    if (!"Basic".equalsIgnoreCase(challenge.getScheme())) continue;

    InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address();
    PasswordAuthentication auth = java.net.Authenticator.requestPasswordAuthentication(
        proxyAddress.getHostName(), getConnectToInetAddress(proxy, url), proxyAddress.getPort(),
        url.getProtocol(), challenge.getRealm(), challenge.getScheme(), url,
        RequestorType.PROXY);
    if (auth == null) continue;

    String credential = Credentials.basic(auth.getUserName(), new String(auth.getPassword()));
    return request.newBuilder()
        .header("Proxy-Authorization", credential)
        .build();
  }
  return null;
}
HttpURLConnection.java 文件源码 项目:openjdk-source-code-learn 阅读 26 收藏 0 点赞 0 评论 0
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.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.FINEST)) {
                    logger.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                }
                return pass;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:openjdk-source-code-learn 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
HttpURLConnection.java 文件源码 项目:OLD-OpenJDK8 阅读 22 收藏 0 点赞 0 评论 0
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;
            }
        });
}
HttpCallerInfo.java 文件源码 项目:OLD-OpenJDK8 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
}
HttpURLConnection.java 文件源码 项目:silvertunnel-monteux 阅读 52 收藏 0 点赞 0 评论 0
/**
 * privileged request password authentication.
 */
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>()
            {
                @Override
                public PasswordAuthentication run()
                {
                    return Authenticator.requestPasswordAuthentication(
                            host, addr, port, protocol, prompt, scheme,
                            url, authType);
                }
            });
}


问题


面经


文章

微信
公众号

扫码关注公众号