如何设置凭据的加密密码以使用sbt发布Nexus OSS? [英] How to set encrypted password to credentials to publish Nexus OSS with sbt?
问题描述
我正在尝试使用global.sbt
中的未加密密码访问Nexus OSS存储库,例如这个,我的global.sbt
是:
I'm trying to access a Nexus OSS repository with unencrypted password in global.sbt
like this, my global.sbt
is:
credentials += Credentials("Sonatype Nexus", "repo.example.com", "username", "unencrypted_password")
我想考虑设置加密密码.
I'd like to thinking about setting encrypted password.
推荐答案
您可以在~/.ivy2/.credentials
下创建一个名为.credentials
的文件.这是一个相当标准的位置,但是显然您可以将文件放置在磁盘上的任何位置.
You can create a file called .credentials
, under ~/.ivy2/.credentials
. That's a fairly standard location, but obviously you can place your file anywhere on disk.
文件如下:
realm = Sonatype Nexus Repository Manager
host = oss.sonatype.org
user = publishing@yourco.com
password = $encrypted
要加密密码,您可以使用一个已知的AES密码,这意味着您基本上可以执行以下操作:
To encrypt the password, you can use a known AES cypher, which means you can basically do something like this:
val credential: DirectCredentials = Credentials(Path.userHome / ".ivy2" / ".credentials")
val decrypted = credential.copy(passwd = decryptAes(credential.passwd))
现在您需要的是一家全公司或类似公司的共享密码,以及一种解密AES的方法,为此,
Now what you need is a shared cypher company wide or similar, as well as a method to decrypt AES, and for that look here.
这篇关于如何设置凭据的加密密码以使用sbt发布Nexus OSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!