Java 类java.net.Authenticator.RequestorType 实例源码
项目:OpenJSharp
文件:HttpURLConnection.java
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;
}
});
}
项目:OpenJSharp
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:boohee_v5.6
文件:AuthenticatorAdapter.java
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;
}
项目:boohee_v5.6
文件:AuthenticatorAdapter.java
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;
}
项目:jdk8u-jdk
文件:HttpURLConnection.java
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;
}
});
}
项目:jdk8u-jdk
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:openjdk-jdk10
文件:HttpCallerInfo.java
/**
* 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;
}
项目:silvertunnel-ng
文件:HttpURLConnection.java
/**
* 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);
}
});
}
项目:openjdk9
文件:HttpURLConnection.java
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;
}
});
}
项目:openjdk9
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:jdk8u_jdk
文件:HttpURLConnection.java
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;
}
});
}
项目:jdk8u_jdk
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:lookaside_java-1.8.0-openjdk
文件:HttpURLConnection.java
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;
}
});
}
项目:lookaside_java-1.8.0-openjdk
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:FMTech
文件:AuthenticatorAdapter.java
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;
}
项目:FMTech
文件:AuthenticatorAdapter.java
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;
}
项目:silvertunnel-monteux
文件:HttpURLConnection.java
/**
* 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);
}
});
}
项目:infobip-open-jdk-8
文件:HttpURLConnection.java
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;
}
});
}
项目:infobip-open-jdk-8
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:jdk8u-dev-jdk
文件:HttpURLConnection.java
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;
}
});
}
项目:jdk8u-dev-jdk
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:jdk7-jdk
文件:HttpURLConnection.java
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;
}
});
}
项目:jdk7-jdk
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:spdymcsclient
文件:AuthenticatorAdapter.java
@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;
}
项目:spdymcsclient
文件:AuthenticatorAdapter.java
@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;
}
项目:openjdk-source-code-learn
文件:HttpURLConnection.java
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;
}
});
}
项目:openjdk-source-code-learn
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:OLD-OpenJDK8
文件:HttpURLConnection.java
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;
}
});
}
项目:OLD-OpenJDK8
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:silvertunnel-monteux
文件:HttpURLConnection.java
/**
* 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);
}
});
}
项目:openjdk-jdk7u-jdk
文件:HttpURLConnection.java
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;
}
});
}
项目:openjdk-jdk7u-jdk
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:openjdk-icedtea7
文件:HttpURLConnection.java
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;
}
});
}
项目:openjdk-icedtea7
文件:HttpCallerInfo.java
/**
* 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 = "";
}
项目:netlib
文件:HttpURLConnection.java
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() {
return Authenticator.requestPasswordAuthentication(
host, addr, port, protocol,
prompt, scheme, url, authType);
}
});
}
项目:GitHub
文件:JavaNetAuthenticator.java
@Override public Request authenticate(Route route, Response response) throws IOException {
List<Challenge> challenges = response.challenges();
Request request = response.request();
HttpUrl url = request.url();
boolean proxyAuthorization = response.code() == 407;
Proxy proxy = route.proxy();
for (int i = 0, size = challenges.size(); i < size; i++) {
Challenge challenge = challenges.get(i);
if (!"Basic".equalsIgnoreCase(challenge.scheme())) continue;
PasswordAuthentication auth;
if (proxyAuthorization) {
InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address();
auth = java.net.Authenticator.requestPasswordAuthentication(
proxyAddress.getHostName(), getConnectToInetAddress(proxy, url), proxyAddress.getPort(),
url.scheme(), challenge.realm(), challenge.scheme(), url.url(),
RequestorType.PROXY);
} else {
auth = java.net.Authenticator.requestPasswordAuthentication(
url.host(), getConnectToInetAddress(proxy, url), url.port(), url.scheme(),
challenge.realm(), challenge.scheme(), url.url(), RequestorType.SERVER);
}
if (auth != null) {
String credential = Credentials.basic(auth.getUserName(), new String(auth.getPassword()));
return request.newBuilder()
.header(proxyAuthorization ? "Proxy-Authorization" : "Authorization", credential)
.build();
}
}
return null; // No challenges were satisfied!
}
项目:GitHub
文件:JavaNetAuthenticator.java
@Override public Request authenticate(Route route, Response response) throws IOException {
List<Challenge> challenges = response.challenges();
Request request = response.request();
HttpUrl url = request.url();
boolean proxyAuthorization = response.code() == 407;
Proxy proxy = route.proxy();
for (int i = 0, size = challenges.size(); i < size; i++) {
Challenge challenge = challenges.get(i);
if (!"Basic".equalsIgnoreCase(challenge.scheme())) continue;
PasswordAuthentication auth;
if (proxyAuthorization) {
InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address();
auth = java.net.Authenticator.requestPasswordAuthentication(
proxyAddress.getHostName(), getConnectToInetAddress(proxy, url), proxyAddress.getPort(),
url.scheme(), challenge.realm(), challenge.scheme(), url.url(),
RequestorType.PROXY);
} else {
auth = java.net.Authenticator.requestPasswordAuthentication(
url.host(), getConnectToInetAddress(proxy, url), url.port(), url.scheme(),
challenge.realm(), challenge.scheme(), url.url(), RequestorType.SERVER);
}
if (auth != null) {
String credential = Credentials.basic(
auth.getUserName(), new String(auth.getPassword()), challenge.charset());
return request.newBuilder()
.header(proxyAuthorization ? "Proxy-Authorization" : "Authorization", credential)
.build();
}
}
return null; // No challenges were satisfied!
}
项目:OpenJSharp
文件:NegotiateAuthentication.java
/**
* Constructor used for both WWW and proxy entries.
* @param hci a schemed object.
*/
public NegotiateAuthentication(HttpCallerInfo hci) {
super(RequestorType.PROXY==hci.authType ? PROXY_AUTHENTICATION : SERVER_AUTHENTICATION,
hci.scheme.equalsIgnoreCase("Negotiate") ? NEGOTIATE : KERBEROS,
hci.url,
"");
this.hci = hci;
}
项目:OpenJSharp
文件:HttpCallerInfo.java
/**
* Constructor an un-schemed object for proxy access.
*/
public HttpCallerInfo(URL url, String host, int port) {
this.url= url;
this.host = host;
this.port = port;
prompt = "";
addr = null;
protocol = url.getProtocol();
authType = RequestorType.PROXY;
scheme = "";
}
项目:OpenJSharp
文件:DefaultAuthenticator.java
@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;
}