Exemplo n.º 1
0
  /**
   * Processes the Digest challenge.
   *
   * @param header the challenge header
   * @throws MalformedChallengeException is thrown if the authentication challenge is malformed
   */
  @Override
  public void processChallenge(final Header header) throws MalformedChallengeException {
    super.processChallenge(header);

    if (getParameter("realm") == null) {
      throw new MalformedChallengeException("missing realm in challenge");
    }
    if (getParameter("nonce") == null) {
      throw new MalformedChallengeException("missing nonce in challenge");
    }
    this.complete = true;
  }
Exemplo n.º 2
0
  /**
   * Processes the Digest challenge.
   *
   * @param header the challenge header
   * @throws MalformedChallengeException is thrown if the authentication challenge is malformed
   */
  @Override
  public void processChallenge(final Header header) throws MalformedChallengeException {
    super.processChallenge(header);

    if (getParameter("realm") == null) {
      throw new MalformedChallengeException("missing realm in challange");
    }
    if (getParameter("nonce") == null) {
      throw new MalformedChallengeException("missing nonce in challange");
    }

    boolean unsupportedQop = false;
    // qop parsing
    String qop = getParameter("qop");
    if (qop != null) {
      StringTokenizer tok = new StringTokenizer(qop, ",");
      while (tok.hasMoreTokens()) {
        String variant = tok.nextToken().trim();
        if (variant.equals("auth")) {
          qopVariant = QOP_AUTH;
          break; // that's our favourite, because auth-int is unsupported
        } else if (variant.equals("auth-int")) {
          qopVariant = QOP_AUTH_INT;
        } else {
          unsupportedQop = true;
        }
      }
    }

    if (unsupportedQop && (qopVariant == QOP_MISSING)) {
      throw new MalformedChallengeException("None of the qop methods is supported");
    }
    // Reset cnonce
    this.cnonce = null;
    this.complete = true;
  }
Exemplo n.º 3
0
 /**
  * Processes the Basic challenge.
  *
  * @param header the challenge header
  * @throws MalformedChallengeException is thrown if the authentication challenge is malformed
  */
 @Override
 public void processChallenge(final Header header) throws MalformedChallengeException {
   super.processChallenge(header);
   this.complete = true;
 }