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

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

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

AuthenticationException介绍

[英]Signals a failure in authentication process
[中]表示身份验证过程失败

代码示例

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

/**
 * Encrypt the data.
 * @param key The key.
 * @param bytes The data
 * @return byte[] The encrypted data
 * @throws HttpException If {@link Cipher.doFinal(byte[])} fails
 */
private byte[] encrypt(byte[] key, byte[] bytes)
  throws AuthenticationException {
  Cipher ecipher = getCipher(key);
  try {
    byte[] enc = ecipher.doFinal(bytes);
    return enc;
  } catch (IllegalBlockSizeException e) {
    throw new AuthenticationException("Invalid block size for DES encryption.", e);
  } catch (BadPaddingException e) {
    throw new AuthenticationException("Data not padded correctly for DES encryption.", e);
  }
}

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

private void authenticate(final HttpMethod method) {
  try {
    if (this.conn.isProxied() && !this.conn.isSecure()) {
      authenticateProxy(method);
    }
    authenticateHost(method);
  } catch (AuthenticationException e) {
    LOG.error(e.getMessage(), e);
  }
}

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

/**
 * Return the cipher for the specified key.
 * @param key The key.
 * @return Cipher The cipher.
 * @throws AuthenticationException If the cipher cannot be retrieved.
 */
private Cipher getCipher(byte[] key) throws AuthenticationException {
  try {
    final Cipher ecipher = Cipher.getInstance("DES/ECB/NoPadding");
    key = setupKey(key);
    ecipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "DES"));
    return ecipher;
  } catch (NoSuchAlgorithmException e) {
    throw new AuthenticationException("DES encryption is not available.", e);
  } catch (InvalidKeyException e) {
    throw new AuthenticationException("Invalid key for DES encryption.", e);
  } catch (NoSuchPaddingException e) {
    throw new AuthenticationException(
      "NoPadding option for DES is not available.", e);
  }
}

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

authenticateProxy(this.connectMethod);
} catch (AuthenticationException e) {
  LOG.error(e.getMessage(), e);

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

throw new AuthenticationException(
    "Unsupported qop in HTTP Digest authentication");   
  md5Helper = MessageDigest.getInstance(digAlg);
} catch (Exception e) {
  throw new AuthenticationException(
   "Unsupported algorithm in HTTP Digest authentication: "
    + digAlg);

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

private void authenticate(final HttpMethod method) {
  try {
    if (this.conn.isProxied() && !this.conn.isSecure()) {
      authenticateProxy(method);
    }
    authenticateHost(method);
  } catch (AuthenticationException e) {
    LOG.error(e.getMessage(), e);
  }
}

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

throw new AuthenticationException(id + 
  " authorization challenge expected, but not found");

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

private void authenticate(final HttpMethod method) {
  try {
    if (this.conn.isProxied() && !this.conn.isSecure()) {
      authenticateProxy(method);
    }
    authenticateHost(method);
  } catch (AuthenticationException e) {
    LOG.error(e.getMessage(), e);
  }
}

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

/** Read a byte from a position within the message buffer */
protected byte readByte(final int position) throws AuthenticationException {
  if (messageContents.length < position + 1) {
    throw new AuthenticationException("NTLM: Message too short");
  }
  return messageContents[position];
}

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

private void authenticate(final HttpMethod method) {
  try {
    if (this.conn.isProxied() && !this.conn.isSecure()) {
      authenticateProxy(method);
    }
    authenticateHost(method);
  } catch (AuthenticationException e) {
    LOG.error(e.getMessage(), e);
  }
}

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

/**
 * Find the character set based on the flags.
 * @param flags is the flags.
 * @return the character set.
 */
private static Charset getCharset(final int flags) throws AuthenticationException
{
  if ((flags & FLAG_REQUEST_UNICODE_ENCODING) == 0) {
    return DEFAULT_CHARSET;
  } else {
    if (UNICODE_LITTLE_UNMARKED == null) {
      throw new AuthenticationException( "Unicode not supported" );
    }
    return UNICODE_LITTLE_UNMARKED;
  }
}

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

private void authenticate(final HttpMethod method) {
  try {
    if (this.conn.isProxied() && !this.conn.isSecure()) {
      authenticateProxy(method);
    }
    authenticateHost(method);
  } catch (AuthenticationException e) {
    LOG.error(e.getMessage(), e);
  }
}

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

/** Read a bunch of bytes from a position in the message buffer */
protected void readBytes(final byte[] buffer, final int position) throws AuthenticationException {
  if (messageContents.length < position + buffer.length) {
    throw new AuthenticationException("NTLM: Message too short");
  }
  System.arraycopy(messageContents, position, buffer, 0, buffer.length);
}

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

private void authenticate(final HttpMethod method) {
  try {
    if (this.conn.isProxied() && !this.conn.isSecure()) {
      authenticateProxy(method);
    }
    authenticateHost(method);
  } catch (AuthenticationException e) {
    LOG.error(e.getMessage(), e);
  }
}

代码示例来源:origin: org.apache.abdera/abdera-extensions-wsse

private String generateNonce() throws AuthenticationException {
  try {
    SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
    byte[] temp = new byte[NONCE_LENGTH];
    sr.nextBytes(temp);
    String n = new String(Hex.encodeHex(temp));
    return n;
  } catch (Exception e) {
    throw new AuthenticationException(e.getMessage(), e);
  }
}

代码示例来源:origin: rombert/ereviewboard

throw new ReviewboardException(e.getMessage(), e);
} finally {
  loginRequest.releaseConnection();

代码示例来源:origin: org.apache.abdera/abdera-extensions-oauth

private String generateNonce() throws AuthenticationException {
  try {
    SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
    byte[] temp = new byte[NONCE_LENGTH];
    sr.nextBytes(temp);
    String n = new String(Hex.encodeHex(temp));
    return n;
  } catch (Exception e) {
    throw new AuthenticationException(e.getMessage(), e);
  }
}

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

authenticateProxy(this.connectMethod);
} catch (AuthenticationException e) {
  LOG.error(e.getMessage(), e);

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

/** Calculates RC4 */
static byte[] RC4(final byte[] value, final byte[] key)
  throws AuthenticationException {
  try {
    final Cipher rc4 = Cipher.getInstance("RC4");
    rc4.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "RC4"));
    return rc4.doFinal(value);
  } catch (final Exception e) {
    throw new AuthenticationException(e.getMessage(), e);
  }
}

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

authenticateProxy(this.connectMethod);
} catch (AuthenticationException e) {
  LOG.error(e.getMessage(), e);

相关文章

微信公众号

最新文章

更多