org.apache.commons.httpclient.auth.AuthChallengeParser类的使用及代码示例

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

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

AuthChallengeParser介绍

[英]This class provides utility methods for parsing HTTP www and proxy authentication challenges.
[中]此类提供用于解析HTTP www和代理身份验证挑战的实用工具方法。

代码示例

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

/** 
   * Extracts a map of challenges ordered by authentication scheme name
   *
   * @param headers the array of authorization challenges
   * @return a map of authorization challenges
   * 
   * @throws MalformedChallengeException if any of challenge strings
   *  is malformed
   * 
   * @since 3.0
   */
  public static Map parseChallenges(final Header[] headers)
   throws MalformedChallengeException {
    if (headers == null) {
      throw new IllegalArgumentException("Array of challenges may not be null");
    }
    String challenge = null;
    Map challengemap = new HashMap(headers.length); 
    for (int i = 0; i < headers.length; i++) {
      challenge = headers[i].getValue();
      String s = AuthChallengeParser.extractScheme(challenge);
      challengemap.put(s, challenge);
    }
    return challengemap;
  }
}

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

/**
 * Processes the given challenge token. Some authentication schemes
 * may involve multiple challenge-response exchanges. Such schemes must be able 
 * to maintain the state information when dealing with sequential challenges 
 * 
 * @param challenge the challenge string
 * 
 * @throws MalformedChallengeException is thrown if the authentication challenge
 * is malformed
 * 
 * @since 3.0
 */
public void processChallenge(final String challenge) throws MalformedChallengeException {
  String s = AuthChallengeParser.extractScheme(challenge);
  if (!s.equalsIgnoreCase(getSchemeName())) {
    throw new MalformedChallengeException(
     "Invalid " + getSchemeName() + " challenge: " + challenge); 
  }
  this.params = AuthChallengeParser.extractParams(challenge);
}

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

Map proxyChallenges = AuthChallengeParser.parseChallenges(
  method.getResponseHeaders(PROXY_AUTH_CHALLENGE));
if (proxyChallenges.isEmpty()) {

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

/**
 * Processes the NTLM challenge.
 *  
 * @param challenge the challenge string
 * 
 * @throws MalformedChallengeException is thrown if the authentication challenge
 * is malformed
 * 
 * @since 3.0
 */
public void processChallenge(final String challenge) throws MalformedChallengeException {
  String s = AuthChallengeParser.extractScheme(challenge);
  if (!s.equalsIgnoreCase(getSchemeName())) {
    throw new MalformedChallengeException("Invalid NTLM challenge: " + challenge);
  }
  int i = challenge.indexOf(' ');
  if (i != -1) {
    s = challenge.substring(i, challenge.length());
    this.ntlmchallenge = s.trim();
    this.state = TYPE2_MSG_RECEIVED;
  } else {
    this.ntlmchallenge = "";
    if (this.state == UNINITIATED) {
      this.state = INITIATED;
    } else {
      this.state = FAILED;
    }
  }
}

代码示例来源:origin: nextcloud/android-library

/**
 * Processes the Bearer challenge.
 *  
 * @param   challenge                   The challenge string
 * 
 * @throws MalformedChallengeException  Thrown if the authentication challenge is malformed
 */
public void processChallenge(String challenge) throws MalformedChallengeException {
  String s = AuthChallengeParser.extractScheme(challenge);
  if (!s.equalsIgnoreCase(getSchemeName())) {
    throw new MalformedChallengeException(
     "Invalid " + getSchemeName() + " challenge: " + challenge); 
  }
  mParams = AuthChallengeParser.extractParams(challenge);
  mComplete = true;
}

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

Map challenges = AuthChallengeParser.parseChallenges(
  method.getResponseHeaders(WWW_AUTH_CHALLENGE));
if (challenges.isEmpty()) {

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

for (int i = 0; i < challenges.length; i++) {
  challenge = challenges[i].getValue();
  String s = AuthChallengeParser.extractScheme(challenge);
  challengemap.put(s, challenge);

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

/**
 * Processes the given challenge token. Some authentication schemes
 * may involve multiple challenge-response exchanges. Such schemes must be able 
 * to maintain the state information when dealing with sequential challenges 
 * 
 * @param challenge the challenge string
 * 
 * @throws MalformedChallengeException is thrown if the authentication challenge
 * is malformed
 * 
 * @since 3.0
 */
public void processChallenge(final String challenge) throws MalformedChallengeException {
  String s = AuthChallengeParser.extractScheme(challenge);
  if (!s.equalsIgnoreCase(getSchemeName())) {
    throw new MalformedChallengeException(
     "Invalid " + getSchemeName() + " challenge: " + challenge); 
  }
  this.params = AuthChallengeParser.extractParams(challenge);
}

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

Map proxyChallenges = AuthChallengeParser.parseChallenges(
  method.getResponseHeaders(PROXY_AUTH_CHALLENGE));
if (proxyChallenges.isEmpty()) {

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

/** 
   * Extracts a map of challenges ordered by authentication scheme name
   *
   * @param headers the array of authorization challenges
   * @return a map of authorization challenges
   * 
   * @throws MalformedChallengeException if any of challenge strings
   *  is malformed
   * 
   * @since 3.0
   */
  public static Map parseChallenges(final Header[] headers)
   throws MalformedChallengeException {
    if (headers == null) {
      throw new IllegalArgumentException("Array of challenges may not be null");
    }
    String challenge = null;
    Map challengemap = new HashMap(headers.length); 
    for (int i = 0; i < headers.length; i++) {
      challenge = headers[i].getValue();
      String s = AuthChallengeParser.extractScheme(challenge);
      challengemap.put(s, challenge);
    }
    return challengemap;
  }
}

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

/**
 * Processes the given challenge token. Some authentication schemes
 * may involve multiple challenge-response exchanges. Such schemes must be able 
 * to maintain the state information when dealing with sequential challenges 
 * 
 * @param challenge the challenge string
 * 
 * @throws MalformedChallengeException is thrown if the authentication challenge
 * is malformed
 * 
 * @since 3.0
 */
public void processChallenge(final String challenge) throws MalformedChallengeException {
  String s = AuthChallengeParser.extractScheme(challenge);
  if (!s.equalsIgnoreCase(getSchemeName())) {
    throw new MalformedChallengeException(
     "Invalid " + getSchemeName() + " challenge: " + challenge); 
  }
  this.params = AuthChallengeParser.extractParams(challenge);
}

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

Map proxyChallenges = AuthChallengeParser.parseChallenges(
  method.getResponseHeaders(PROXY_AUTH_CHALLENGE));
if (proxyChallenges.isEmpty()) {

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

/** 
   * Extracts a map of challenges ordered by authentication scheme name
   *
   * @param headers the array of authorization challenges
   * @return a map of authorization challenges
   * 
   * @throws MalformedChallengeException if any of challenge strings
   *  is malformed
   * 
   * @since 3.0
   */
  public static Map parseChallenges(final Header[] headers)
   throws MalformedChallengeException {
    if (headers == null) {
      throw new IllegalArgumentException("Array of challenges may not be null");
    }
    String challenge = null;
    Map challengemap = new HashMap(headers.length); 
    for (int i = 0; i < headers.length; i++) {
      challenge = headers[i].getValue();
      String s = AuthChallengeParser.extractScheme(challenge);
      challengemap.put(s, challenge);
    }
    return challengemap;
  }
}

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

/**
 * Processes the given challenge token. Some authentication schemes
 * may involve multiple challenge-response exchanges. Such schemes must be able 
 * to maintain the state information when dealing with sequential challenges 
 * 
 * @param challenge the challenge string
 * 
 * @throws MalformedChallengeException is thrown if the authentication challenge
 * is malformed
 * 
 * @since 3.0
 */
public void processChallenge(final String challenge) throws MalformedChallengeException {
  String s = AuthChallengeParser.extractScheme(challenge);
  if (!s.equalsIgnoreCase(getSchemeName())) {
    throw new MalformedChallengeException(
     "Invalid " + getSchemeName() + " challenge: " + challenge); 
  }
  this.params = AuthChallengeParser.extractParams(challenge);
}

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

Map proxyChallenges = AuthChallengeParser.parseChallenges(
  method.getResponseHeaders(PROXY_AUTH_CHALLENGE));
if (proxyChallenges.isEmpty()) {

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

/** 
   * Extracts a map of challenges ordered by authentication scheme name
   *
   * @param headers the array of authorization challenges
   * @return a map of authorization challenges
   * 
   * @throws MalformedChallengeException if any of challenge strings
   *  is malformed
   * 
   * @since 3.0
   */
  public static Map parseChallenges(final Header[] headers)
   throws MalformedChallengeException {
    if (headers == null) {
      throw new IllegalArgumentException("Array of challenges may not be null");
    }
    String challenge = null;
    Map challengemap = new HashMap(headers.length); 
    for (int i = 0; i < headers.length; i++) {
      challenge = headers[i].getValue();
      String s = AuthChallengeParser.extractScheme(challenge);
      challengemap.put(s, challenge);
    }
    return challengemap;
  }
}

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

/**
 * Processes the given challenge token. Some authentication schemes
 * may involve multiple challenge-response exchanges. Such schemes must be able 
 * to maintain the state information when dealing with sequential challenges 
 * 
 * @param challenge the challenge string
 * 
 * @throws MalformedChallengeException is thrown if the authentication challenge
 * is malformed
 * 
 * @since 3.0
 */
public void processChallenge(final String challenge) throws MalformedChallengeException {
  String s = AuthChallengeParser.extractScheme(challenge);
  if (!s.equalsIgnoreCase(getSchemeName())) {
    throw new MalformedChallengeException(
     "Invalid " + getSchemeName() + " challenge: " + challenge); 
  }
  this.params = AuthChallengeParser.extractParams(challenge);
}

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

Map proxyChallenges = AuthChallengeParser.parseChallenges(
  method.getResponseHeaders(PROXY_AUTH_CHALLENGE));
if (proxyChallenges.isEmpty()) {

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

/** 
   * Extracts a map of challenges ordered by authentication scheme name
   *
   * @param headers the array of authorization challenges
   * @return a map of authorization challenges
   * 
   * @throws MalformedChallengeException if any of challenge strings
   *  is malformed
   * 
   * @since 3.0
   */
  public static Map parseChallenges(final Header[] headers)
   throws MalformedChallengeException {
    if (headers == null) {
      throw new IllegalArgumentException("Array of challenges may not be null");
    }
    String challenge = null;
    Map challengemap = new HashMap(headers.length); 
    for (int i = 0; i < headers.length; i++) {
      challenge = headers[i].getValue();
      String s = AuthChallengeParser.extractScheme(challenge);
      challengemap.put(s, challenge);
    }
    return challengemap;
  }
}

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

Map<?, ?> proxyChallenges = AuthChallengeParser.parseChallenges(
  method.getResponseHeaders(PROXY_AUTH_CHALLENGE));
if (proxyChallenges.isEmpty()) {

相关文章

微信公众号

最新文章

更多