001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.eclipse.aether.transport.apache; 020 021import org.eclipse.aether.ConfigurationProperties; 022import org.eclipse.aether.RepositorySystemSession; 023 024/** 025 * Configuration for Apache Transport. 026 * 027 * @since 2.0.0 028 */ 029public final class ApacheTransporterConfigurationKeys { 030 private ApacheTransporterConfigurationKeys() {} 031 032 static final String CONFIG_PROPS_PREFIX = 033 ConfigurationProperties.PREFIX_TRANSPORT + ApacheTransporterFactory.NAME + "."; 034 035 /** 036 * If enabled, underlying Apache HttpClient will use system properties as well to configure itself (typically 037 * used to set up HTTP Proxy via Java system properties). See HttpClientBuilder for used properties. This mode 038 * is not recommended, better use documented ways of configuration instead. 039 * 040 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 041 * @configurationType {@link java.lang.Boolean} 042 * @configurationDefaultValue {@link #DEFAULT_USE_SYSTEM_PROPERTIES} 043 * @configurationRepoIdSuffix Yes 044 */ 045 public static final String CONFIG_PROP_USE_SYSTEM_PROPERTIES = CONFIG_PROPS_PREFIX + "useSystemProperties"; 046 047 public static final boolean DEFAULT_USE_SYSTEM_PROPERTIES = false; 048 049 /** 050 * The name of retryHandler, supported values are “standard”, that obeys RFC-2616, regarding idempotent methods, 051 * and “default” that considers requests w/o payload as idempotent. 052 * 053 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 054 * @configurationType {@link java.lang.String} 055 * @configurationDefaultValue {@link #HTTP_RETRY_HANDLER_NAME_STANDARD} 056 * @configurationRepoIdSuffix Yes 057 */ 058 public static final String CONFIG_PROP_HTTP_RETRY_HANDLER_NAME = CONFIG_PROPS_PREFIX + "retryHandler.name"; 059 060 public static final String HTTP_RETRY_HANDLER_NAME_STANDARD = "standard"; 061 062 public static final String HTTP_RETRY_HANDLER_NAME_DEFAULT = "default"; 063 064 /** 065 * Set to true if it is acceptable to retry non-idempotent requests, that have been sent. 066 * 067 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 068 * @configurationType {@link java.lang.Boolean} 069 * @configurationDefaultValue {@link #DEFAULT_HTTP_RETRY_HANDLER_REQUEST_SENT_ENABLED} 070 * @configurationRepoIdSuffix Yes 071 */ 072 public static final String CONFIG_PROP_HTTP_RETRY_HANDLER_REQUEST_SENT_ENABLED = 073 CONFIG_PROPS_PREFIX + "retryHandler.requestSentEnabled"; 074 075 public static final boolean DEFAULT_HTTP_RETRY_HANDLER_REQUEST_SENT_ENABLED = false; 076 077 /** 078 * Comma-separated list of 079 * <a href="https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#ciphersuites">Cipher 080 * Suites</a> which are enabled for HTTPS connections. 081 * 082 * @since 2.0.0 083 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 084 * @configurationType {@link java.lang.String} 085 */ 086 public static final String CONFIG_PROP_CIPHER_SUITES = CONFIG_PROPS_PREFIX + "https.cipherSuites"; 087 088 /** 089 * Comma-separated list of 090 * <a href="https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#jssenames">Protocols 091 * </a> which are enabled for HTTPS connections. 092 * 093 * @since 2.0.0 094 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 095 * @configurationType {@link java.lang.String} 096 */ 097 public static final String CONFIG_PROP_PROTOCOLS = CONFIG_PROPS_PREFIX + "https.protocols"; 098 099 /** 100 * If enabled, Apache HttpClient will follow HTTP redirects. 101 * 102 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 103 * @configurationType {@link Boolean} 104 * @configurationDefaultValue {@link #DEFAULT_FOLLOW_REDIRECTS} 105 * @configurationRepoIdSuffix Yes 106 * @since 2.0.2 107 */ 108 public static final String CONFIG_PROP_FOLLOW_REDIRECTS = CONFIG_PROPS_PREFIX + "followRedirects"; 109 110 public static final boolean DEFAULT_FOLLOW_REDIRECTS = true; 111 112 /** 113 * If enabled (default), operator-configured request headers ({@code aether.transport.http.headers}) are only 114 * sent on requests targeting the repository origin (the scheme, host and port the repository URL denotes). 115 * Apache HttpClient re-sends the original request headers on redirects, so without origin scoping a 116 * cross-origin redirect replays the configured headers - which frequently carry credentials such as 117 * {@code Authorization}, cookies or private token headers - to the redirect target host. Disable only when a 118 * redirect target legitimately requires the configured headers. 119 * 120 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 121 * @configurationType {@link Boolean} 122 * @configurationDefaultValue {@link #DEFAULT_ORIGIN_SCOPED_HEADERS} 123 * @configurationRepoIdSuffix Yes 124 * @since 2.0.23 125 */ 126 public static final String CONFIG_PROP_ORIGIN_SCOPED_HEADERS = CONFIG_PROPS_PREFIX + "originScopedHeaders"; 127 128 public static final boolean DEFAULT_ORIGIN_SCOPED_HEADERS = true; 129 130 /** 131 * The max redirect count to follow. 132 * 133 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 134 * @configurationType {@link java.lang.Integer} 135 * @configurationDefaultValue {@link #DEFAULT_MAX_REDIRECTS} 136 * @configurationRepoIdSuffix Yes 137 * @since 2.0.2 138 */ 139 public static final String CONFIG_PROP_MAX_REDIRECTS = CONFIG_PROPS_PREFIX + "maxRedirects"; 140 141 public static final int DEFAULT_MAX_REDIRECTS = 5; 142 143 /** 144 * If enabled, Apache HttpClient will follow redirects that downgrade the protocol from https to http. Disabled 145 * by default: such a downgrade strips transport encryption from artifact and checksum bytes and makes repository 146 * credentials eligible for transmission over plaintext, so a downgrading redirect fails the transfer instead. 147 * 148 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 149 * @configurationType {@link Boolean} 150 * @configurationDefaultValue {@link #DEFAULT_FOLLOW_INSECURE_REDIRECTS} 151 * @configurationRepoIdSuffix Yes 152 * @since 2.0.23 153 */ 154 public static final String CONFIG_PROP_FOLLOW_INSECURE_REDIRECTS = CONFIG_PROPS_PREFIX + "followInsecureRedirects"; 155 156 public static final boolean DEFAULT_FOLLOW_INSECURE_REDIRECTS = false; 157}