本文整理了Java中org.apache.commons.httpclient.auth.AuthState
类的一些代码示例,展示了AuthState
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AuthState
类的具体详情如下:
包路径:org.apache.commons.httpclient.auth.AuthState
类名称:AuthState
[英]This class provides detailed information about the state of the authentication process.
[中]此类提供有关身份验证过程状态的详细信息。
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Assigns the given {@link AuthScheme authentication scheme}.
*
* @param authScheme the {@link AuthScheme authentication scheme}
*/
public void setAuthScheme(final AuthScheme authScheme) {
if (authScheme == null) {
invalidate();
return;
}
if (this.preemptive && !(this.authScheme.getClass().isInstance(authScheme))) {
this.preemptive = false;
this.authAttempted = false;
}
this.authScheme = authScheme;
}
代码示例来源:origin: commons-httpclient/commons-httpclient
AuthScheme authscheme = authstate.getAuthScheme();
if (authscheme == null) {
return;
if (authstate.isAuthRequested() || !authscheme.isConnectionBased()) {
AuthScope authscope = new AuthScope(
conn.getProxyHost(), conn.getProxyPort(),
if (LOG.isWarnEnabled()) {
LOG.warn("Required proxy credentials not available for " + authscope);
if (method.getProxyAuthState().isPreemptive()) {
LOG.warn("Preemptive authentication requested but no default " +
"proxy credentials available");
代码示例来源:origin: commons-httpclient/commons-httpclient
LOG.debug("Proxy authentication scope: " + authscope);
if (authstate.isAuthAttempted() && authscheme.isComplete()) {
authstate.setAuthAttempted(true);
Credentials credentials = this.state.getProxyCredentials(authscope);
if (credentials == null) {
代码示例来源:origin: commons-httpclient/commons-httpclient
if (state.isPreemptive() || state.getAuthScheme() == null) {
state.setAuthScheme(selectAuthScheme(challenges));
AuthScheme authscheme = state.getAuthScheme();
String id = authscheme.getSchemeName();
if (LOG.isDebugEnabled()) {
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Tests if the {@link HttpMethod method} requires authentication.
*
* @param method HTTP method
*
* @return boolean <tt>true</tt> if a retry is needed, <tt>false</tt> otherwise.
*/
private boolean isAuthenticationNeeded(final HttpMethod method) {
method.getHostAuthState().setAuthRequested(
method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED);
method.getProxyAuthState().setAuthRequested(
method.getStatusCode() == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (method.getHostAuthState().isAuthRequested() ||
method.getProxyAuthState().isAuthRequested()) {
LOG.debug("Authorization required");
if (method.getDoAuthentication()) { //process authentication response
return true;
} else { //let the client handle the authenticaiton
LOG.info("Authentication requested but doAuthentication is "
+ "disabled");
return false;
}
} else {
return false;
}
}
代码示例来源:origin: commons-httpclient/commons-httpclient
this.connectMethod.getResponseBodyAsStream()
);
method.getProxyAuthState().setAuthScheme(
this.connectMethod.getProxyAuthState().getAuthScheme());
this.connectMethod = null;
} else {
代码示例来源:origin: commons-httpclient/commons-httpclient
|| this.state.isAuthenticationPreemptive()) {
LOG.debug("Preemptively sending default basic credentials");
this.connectMethod.getProxyAuthState().setPreemptive();
this.connectMethod.getProxyAuthState().setAuthAttempted(true);
boolean retry = false;
AuthState authstate = this.connectMethod.getProxyAuthState();
authstate.setAuthRequested(code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (authstate.isAuthRequested()) {
if (processAuthenticationResponse(this.connectMethod)) {
retry = true;
代码示例来源:origin: commons-httpclient/commons-httpclient
method.getHostAuthState().setPreemptive();
method.getHostAuthState().setAuthAttempted(true);
if (this.conn.isProxied() && !this.conn.isSecure()) {
method.getProxyAuthState().setPreemptive();
method.getProxyAuthState().setAuthAttempted(true);
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Returns proxy authentication realm, if it has been used during authentication process.
* Otherwise returns <tt>null</tt>.
*
* @return proxy authentication realm
*
* @deprecated use #getProxyAuthState()
*/
public String getProxyAuthenticationRealm() {
return this.proxyAuthState.getRealm();
}
代码示例来源:origin: org.eclipse.mylyn.commons/xmlrpc
public void processRequest(HttpMethod method) {
DigestScheme scheme = digestScheme;
if (scheme != null) {
if (DEBUG_AUTH) {
System.err.println(location.getUrl() + ": Digest scheme is present"); //$NON-NLS-1$
}
Credentials creds = httpClient.getState().getCredentials(authScope);
if (creds != null) {
if (DEBUG_AUTH) {
System.err.println(location.getUrl() + ": Setting digest scheme for request"); //$NON-NLS-1$
}
method.getHostAuthState().setAuthScheme(digestScheme);
method.getHostAuthState().setAuthRequested(true);
}
}
}
代码示例来源:origin: org.eclipse.mylyn.commons/xmlrpc
@SuppressWarnings("null")
public void processResponse(HttpMethod method) throws XmlRpcException {
if (isContentTypeCheckingEnabled()) {
Header contentTypeHeader = method.getResponseHeader("Content-Type"); //$NON-NLS-1$
if (contentTypeHeader == null || !DEFAULT_CONTENT_TYPE.equals(contentTypeHeader.getValue())) {
throw new XmlRpcIllegalContentTypeException(
NLS.bind(
"The server returned an unexpected content type: ''{0}''", contentTypeHeader.getValue()), contentTypeHeader.getValue()); //$NON-NLS-1$
}
}
AuthScheme authScheme = method.getHostAuthState().getAuthScheme();
if (authScheme instanceof DigestScheme) {
digestScheme = (DigestScheme) authScheme;
if (DEBUG_AUTH) {
System.err.println(location.getUrl() + ": Received digest scheme"); //$NON-NLS-1$
}
}
}
});
代码示例来源:origin: com.atlassian.bamboo.plugins.tomcat/bamboo-tomcat-plugin
private void addHeaders(HttpMethod httpMethod)
{
httpMethod.setDoAuthentication(true);
httpMethod.addRequestHeader("User-Agent", "Atlassian Tomcat API");
httpMethod.getHostAuthState().isPreemptive();
}
代码示例来源:origin: edu.ucar/netcdf
if(retryCount == 0 && authstate.isAuthAttempted() && authscheme.isComplete()) {
return null; // Stop the retry.
代码示例来源:origin: org.apache.portals.applications/apa-webcontent-jar
if (httpMethod.getHostAuthState().isAuthRequested() && retryCount++ < 1 && doRequestedAuthentication( httpClient, httpMethod, request, response))
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
|| this.state.isAuthenticationPreemptive()) {
LOG.debug("Preemptively sending default basic credentials");
this.connectMethod.getProxyAuthState().setPreemptive();
this.connectMethod.getProxyAuthState().setAuthAttempted(true);
boolean retry = false;
AuthState authstate = this.connectMethod.getProxyAuthState();
authstate.setAuthRequested(code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (authstate.isAuthRequested()) {
if (processAuthenticationResponse(this.connectMethod)) {
retry = true;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
if (state.isPreemptive() || state.getAuthScheme() == null) {
state.setAuthScheme(selectAuthScheme(challenges));
AuthScheme authscheme = state.getAuthScheme();
String id = authscheme.getSchemeName();
if (LOG.isDebugEnabled()) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
/**
* Tests if the {@link HttpMethod method} requires authentication.
*
* @param method HTTP method
*
* @return boolean <tt>true</tt> if a retry is needed, <tt>false</tt> otherwise.
*/
private boolean isAuthenticationNeeded(final HttpMethod method) {
method.getHostAuthState().setAuthRequested(
method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED);
method.getProxyAuthState().setAuthRequested(
method.getStatusCode() == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (method.getHostAuthState().isAuthRequested() ||
method.getProxyAuthState().isAuthRequested()) {
LOG.debug("Authorization required");
if (method.getDoAuthentication()) { //process authentication response
return true;
} else { //let the client handle the authenticaiton
LOG.info("Authentication requested but doAuthentication is "
+ "disabled");
return false;
}
} else {
return false;
}
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient
this.connectMethod.getResponseBodyAsStream()
);
method.getProxyAuthState().setAuthScheme(
this.connectMethod.getProxyAuthState().getAuthScheme());
this.connectMethod = null;
} else {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
method.getHostAuthState().setPreemptive();
method.getHostAuthState().setAuthAttempted(true);
if (this.conn.isProxied() && !this.conn.isSecure()) {
method.getProxyAuthState().setPreemptive();
method.getProxyAuthState().setAuthAttempted(true);
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Returns authentication realm, if it has been used during authentication process.
* Otherwise returns <tt>null</tt>.
*
* @return authentication realm
*
* @deprecated use #getHostAuthState()
*/
public String getAuthenticationRealm() {
return this.hostAuthState.getRealm();
}
内容来源于网络,如有侵权,请联系作者删除!