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.
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.
The file looks like this:
realm = Sonatype Nexus Repository Manager
host = oss.sonatype.org
user = publishing@yourco.com
password = $encrypted
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))
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.