org.apache.commons.httpclient.auth.AuthState.setAuthRequested()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.apache.commons.httpclient.auth.AuthState.setAuthRequested()方法的一些代码示例,展示了AuthState.setAuthRequested()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AuthState.setAuthRequested()方法的具体详情如下:
包路径:org.apache.commons.httpclient.auth.AuthState
类名称:AuthState
方法名:setAuthRequested

AuthState.setAuthRequested介绍

[英]Sets authentication request status
[中]设置身份验证请求状态

代码示例

代码示例来源: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

boolean retry = false;
AuthState authstate = this.connectMethod.getProxyAuthState(); 
authstate.setAuthRequested(code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (authstate.isAuthRequested()) {
  if (processAuthenticationResponse(this.connectMethod)) {

代码示例来源: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.apache.commons/com.springsource.org.apache.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/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.wso2.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: 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.zaproxy/zap

/**
 * 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.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

boolean retry = false;
AuthState authstate = this.connectMethod.getProxyAuthState(); 
authstate.setAuthRequested(code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (authstate.isAuthRequested()) {
  if (processAuthenticationResponse(this.connectMethod)) {

代码示例来源:origin: org.apache.commons/httpclient

boolean retry = false;
AuthState authstate = this.connectMethod.getProxyAuthState(); 
authstate.setAuthRequested(code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (authstate.isAuthRequested()) {
  if (processAuthenticationResponse(this.connectMethod)) {

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

boolean retry = false;
AuthState authstate = this.connectMethod.getProxyAuthState(); 
authstate.setAuthRequested(code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (authstate.isAuthRequested()) {
  if (processAuthenticationResponse(this.connectMethod)) {

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

boolean retry = false;
AuthState authstate = this.connectMethod.getProxyAuthState(); 
authstate.setAuthRequested(code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (authstate.isAuthRequested()) {
  if (processAuthenticationResponse(this.connectMethod)) {

代码示例来源:origin: org.zaproxy/zap

boolean retry = false;
AuthState authstate = this.connectMethod.getProxyAuthState(); 
authstate.setAuthRequested(code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
if (authstate.isAuthRequested()) {
  if (processAuthenticationResponse(this.connectMethod)) {

相关文章