Skip to content

Commit

Permalink
Addresses #2954 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcviers committed Feb 5, 2024
1 parent 910da10 commit 504233e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ trait CoursierWorkerModule {
}

/**
* Sets up repositories with mirrors, proxies, and credentials from
* coursier's config sources.
* Sets up repositories with mirrors, proxies, and credentials from coursier's config sources, without overwriting existing authentication.
*
* @return a worker containing the result of applying the coursier credentials, proxy setup, and mirrors to the repositories in coursiers configs
*/
Expand All @@ -64,18 +63,19 @@ trait CoursierWorkerModule {
Await.result(
Resolve().finalRepositories.map {
_.map {
case x: IvyRepository =>
case x: IvyRepository if x.authentication.isEmpty =>
x.withAuthentication(
resolvedCredentials.find { c =>
c.matches(x.pattern.string, c.usernameOpt.getOrElse(""))
}.map(_.authentication)
)
case x: MavenRepository =>
case x: MavenRepository if x.authentication.isEmpty =>
x.withAuthentication(
resolvedCredentials.find { c =>
c.matches(x.root, c.usernameOpt.getOrElse(""))
}.map(_.authentication)
)
case r => r
}
}.future(),
Duration.Inf
Expand Down

0 comments on commit 504233e

Please sign in to comment.