diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-06 20:07:57 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-06 20:07:57 -0500 |
commit | 64ccd14614182c517995a88b888f0d7b7212f668 (patch) | |
tree | 07aa160fd60aa50c5d77a9d48eb8840c925d4fd6 /stage2/Lib.scala | |
parent | 78b22ae86df111b89db1ecb20c40a0384b148698 (diff) | |
download | cbt-64ccd14614182c517995a88b888f0d7b7212f668.tar.gz cbt-64ccd14614182c517995a88b888f0d7b7212f668.tar.bz2 cbt-64ccd14614182c517995a88b888f0d7b7212f668.zip |
support publishing to basic-auth protected maven repositories
Diffstat (limited to 'stage2/Lib.scala')
-rw-r--r-- | stage2/Lib.scala | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/stage2/Lib.scala b/stage2/Lib.scala index 8646f8c..c95ee2a 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -148,6 +148,7 @@ final class Lib(val logger: Logger) extends Stage1Lib(logger){ obj match { case Some(s) => render(s) case None => "" + case url: URL => url.show // to remove credentials case d: Dependency => lib.usage(d.getClass, d.show()) case c: ClassPath => c.string case ExitCode(int) => System.err.println(int); System.exit(int); ??? @@ -462,17 +463,12 @@ final class Lib(val logger: Logger) extends Stage1Lib(logger){ import java.net._ import java.io._ val url = baseUrl ++ "/" ++ fileName - System.err.println(blue("uploading ") ++ url.toString) + System.err.println(blue("uploading ") ++ url.show) val httpCon = Stage0Lib.openConnectionConsideringProxy(url) try{ httpCon.setDoOutput(true) httpCon.setRequestMethod("PUT") - credentials.foreach( - c => { - val encoding = new sun.misc.BASE64Encoder().encode(c.getBytes) - httpCon.setRequestProperty("Authorization", "Basic " ++ encoding) - } - ) + (credentials orElse Option(baseUrl.getUserInfo)).foreach(addHttpCredentials(httpCon,_)) httpCon.setRequestProperty("Content-Type", "application/binary") httpCon.getOutputStream.write( fileContents |