@@ -23,6 +23,7 @@ import java.io.File
2323import java.net.Authenticator
2424import java.net.PasswordAuthentication
2525import java.net.URI
26+ import java.net.URL
2627
2728import kotlin.coroutines.CoroutineContext
2829import kotlin.coroutines.EmptyCoroutineContext
@@ -120,10 +121,10 @@ fun filterVersionNames(version: String, names: List<String>, project: String? =
120121}
121122
122123/* *
123- * Request a [PasswordAuthentication] object for the given [host], [port], and [scheme ]. Install the [OrtAuthenticator]
124- * and the [OrtProxySelector] beforehand to ensure they are active.
124+ * Request a [PasswordAuthentication] object for the given [host], [port], [scheme], and optional [url ]. Install the
125+ * [OrtAuthenticator] and the [OrtProxySelector] beforehand to ensure they are active.
125126 */
126- fun requestPasswordAuthentication (host : String , port : Int , scheme : String ): PasswordAuthentication ? {
127+ fun requestPasswordAuthentication (host : String , port : Int , scheme : String , url : URL ? = null ): PasswordAuthentication ? {
127128 OrtAuthenticator .install()
128129 OrtProxySelector .install()
129130
@@ -133,7 +134,9 @@ fun requestPasswordAuthentication(host: String, port: Int, scheme: String): Pass
133134 /* port = */ port,
134135 /* protocol = */ scheme,
135136 /* prompt = */ null ,
136- /* scheme = */ null
137+ /* scheme = */ null ,
138+ /* url = */ url,
139+ /* reqType = */ Authenticator .RequestorType .SERVER
137140 )
138141}
139142
@@ -142,7 +145,7 @@ fun requestPasswordAuthentication(host: String, port: Int, scheme: String): Pass
142145 * [OrtProxySelector] beforehand to ensure they are active.
143146 */
144147fun requestPasswordAuthentication (uri : URI ): PasswordAuthentication ? =
145- requestPasswordAuthentication(uri.host, uri.port, uri.scheme)
148+ requestPasswordAuthentication(uri.host, uri.port, uri.scheme, uri.toURL() )
146149
147150/* *
148151 * Normalize a string representing a [VCS URL][vcsUrl] to a common string form.
0 commit comments