private void supplyCredentials(URLConnection conn, UrlCredentials urlCreds) throws IOException {
final AuthType type = urlCreds.getType();
final Object[] creds = urlCreds.getCredentials();
if (AuthType.BASIC.equals(type)) {
applyBasicAuthentication(conn, creds);
}
else if (AuthType.CLIENT_CERT.equals(type)) {
applyClientCertificate(conn, creds);
}
else if (!AuthType.NONE.equals(type)) {
throw new IllegalArgumentException("Unknown authentication type: " + type);
}
}
|