mirror of https://github.com/sbt/sbt.git
support ssh/sftp with keyfiles (needed to add user name parameter to 'as')
This commit is contained in:
parent
e3c7cb2ff9
commit
a2d8bd1bee
|
|
@ -85,10 +85,11 @@ private object ConvertResolver
|
||||||
{
|
{
|
||||||
case RepositoryHelpers.PasswordAuthentication(user, password) =>
|
case RepositoryHelpers.PasswordAuthentication(user, password) =>
|
||||||
setUser(user)
|
setUser(user)
|
||||||
setUserPassword(password)
|
password.foreach(setUserPassword)
|
||||||
case RepositoryHelpers.KeyFileAuthentication(file, password) =>
|
case RepositoryHelpers.KeyFileAuthentication(user, file, password) =>
|
||||||
setKeyFile(file)
|
setKeyFile(file)
|
||||||
setKeyFilePassword(password)
|
password.foreach(setKeyFilePassword)
|
||||||
|
setUser(user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private def initializePatterns(resolver: AbstractPatternsBasedResolver, patterns: Patterns)
|
private def initializePatterns(resolver: AbstractPatternsBasedResolver, patterns: Patterns)
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ object RepositoryHelpers
|
||||||
def nonlocal() = FileConfiguration(false, isTransactional)
|
def nonlocal() = FileConfiguration(false, isTransactional)
|
||||||
}
|
}
|
||||||
sealed trait SshAuthentication extends NotNull
|
sealed trait SshAuthentication extends NotNull
|
||||||
final case class PasswordAuthentication(user: String, password: String) extends SshAuthentication
|
final case class PasswordAuthentication(user: String, password: Option[String]) extends SshAuthentication
|
||||||
final case class KeyFileAuthentication(keyfile: File, password: String) extends SshAuthentication
|
final case class KeyFileAuthentication(user: String, keyfile: File, password: Option[String]) extends SshAuthentication
|
||||||
}
|
}
|
||||||
import RepositoryHelpers.{SshConnection, FileConfiguration}
|
import RepositoryHelpers.{SshConnection, FileConfiguration}
|
||||||
import RepositoryHelpers.{KeyFileAuthentication, PasswordAuthentication, SshAuthentication}
|
import RepositoryHelpers.{KeyFileAuthentication, PasswordAuthentication, SshAuthentication}
|
||||||
|
|
@ -124,9 +124,13 @@ sealed abstract class SshBasedRepository extends PatternsBasedRepository
|
||||||
def connection: SshConnection
|
def connection: SshConnection
|
||||||
|
|
||||||
/** Configures this to use the specified user name and password when connecting to the remote repository. */
|
/** Configures this to use the specified user name and password when connecting to the remote repository. */
|
||||||
def as(user: String, password: String): RepositoryType = copy(new PasswordAuthentication(user, password))
|
def as(user: String, password: String): RepositoryType = as(user, Some(password))
|
||||||
|
def as(user: String): RepositoryType = as(user, None)
|
||||||
|
def as(user: String, password: Option[String]) = copy(new PasswordAuthentication(user, password))
|
||||||
/** Configures this to use the specified keyfile and password for the keyfile when connecting to the remote repository. */
|
/** Configures this to use the specified keyfile and password for the keyfile when connecting to the remote repository. */
|
||||||
def as(keyfile: File, password: String): RepositoryType = copy(new KeyFileAuthentication(keyfile, password))
|
def as(user: String, keyfile: File): RepositoryType = as(user, keyfile, None)
|
||||||
|
def as(user: String, keyfile: File, password: String): RepositoryType = as(user, keyfile, Some(password))
|
||||||
|
def as(user: String, keyfile: File, password: Option[String]): RepositoryType = copy(new KeyFileAuthentication(user, keyfile, password))
|
||||||
}
|
}
|
||||||
/** sbt interface for an Ivy repository over ssh. More convenient construction is done using Resolver.ssh. */
|
/** sbt interface for an Ivy repository over ssh. More convenient construction is done using Resolver.ssh. */
|
||||||
final case class SshRepository(name: String, connection: SshConnection, patterns: Patterns, publishPermissions: Option[String]) extends SshBasedRepository
|
final case class SshRepository(name: String, connection: SshConnection, patterns: Patterns, publishPermissions: Option[String]) extends SshBasedRepository
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue