Skip to content

Commit adaad2f

Browse files
GschiavonMarcos P
authored and
Marcos P
committed
Removed unused mehtods and LogInfo msg from VaultHelper (apache#56)
1 parent 733ea2a commit adaad2f

File tree

1 file changed

+4
-37
lines changed

1 file changed

+4
-37
lines changed

core/src/main/scala/org/apache/spark/security/VaultHelper.scala

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ object VaultHelper extends Logging {
3232
logDebug(s"Requesting login from app and role: $requestUrl")
3333
val replace: String = jsonRoleSecretTemplate.replace("_replace_role_", roleId)
3434
.replace("_replace_secret_", secretId)
35-
logInfo(s"getting secret: $secretId and role: $roleId")
36-
logInfo(s"generated JSON: $replace")
35+
logDebug(s"getting secret: $secretId and role: $roleId")
36+
logDebug(s"generated JSON: $replace")
3737
val jsonAppRole = replace
3838
HTTPHelper.executePost(requestUrl, "auth",
3939
None, Some(jsonAppRole))("client_token").asInstanceOf[String]
@@ -43,7 +43,7 @@ object VaultHelper extends Logging {
4343
role: String): String = {
4444
val requestUrl = s"$vaultUrl/v1/auth/approle/role/$role/role-id"
4545
if (!token.isDefined) token = {
46-
logDebug(s"Requesting token from app role:")
46+
logDebug(s"Requesting token from app role: $role")
4747
Option(VaultHelper.getTokenFromAppRole(vaultUrl,
4848
sys.env("VAULT_ROLE_ID"),
4949
sys.env("VAULT_SECRET_ID")))
@@ -57,7 +57,7 @@ object VaultHelper extends Logging {
5757
role: String): String = {
5858
val requestUrl = s"$vaultUrl/v1/auth/approle/role/$role/secret-id"
5959
if (!token.isDefined) token = {
60-
logDebug(s"Requesting token from app role:")
60+
logDebug(s"Requesting token from app role: $role")
6161
Option(VaultHelper.getTokenFromAppRole(vaultUrl,
6262
sys.env("VAULT_ROLE_ID"),
6363
sys.env("VAULT_SECRET_ID")))
@@ -90,22 +90,6 @@ object VaultHelper extends Logging {
9090
(keytab64, principal)
9191
}
9292

93-
@deprecated
94-
def getRootCA(vaultUrl: String, token: String): String = {
95-
val certVaultPath = "/v1/ca-trust/certificates/"
96-
val requestUrl = s"$vaultUrl/$certVaultPath"
97-
val listCertKeysVaultPath = s"$requestUrl?list=true"
98-
99-
logDebug(s"Requesting Cert List: $listCertKeysVaultPath")
100-
val keys = HTTPHelper.executeGet(listCertKeysVaultPath,
101-
"data", Some(Seq(("X-Vault-Token", token))))("keys").asInstanceOf[List[String]]
102-
103-
keys.flatMap(key => {
104-
HTTPHelper.executeGet(s"$requestUrl$key",
105-
"data", Some(Seq(("X-Vault-Token", token)))).find(_._1.endsWith("_crt"))
106-
}).map(_._2).mkString
107-
}
108-
10993
def getTrustStore(vaultUrl: String, token: String, certVaultPath: String): String = {
11094
val requestUrl = s"$vaultUrl/$certVaultPath"
11195
val truststoreVaultPath = s"$requestUrl"
@@ -117,14 +101,6 @@ object VaultHelper extends Logging {
117101
trustStore
118102
}
119103

120-
def getCertPassFromVault(vaultUrl: String, token: String): String = {
121-
val certPassVaultPath = "/v1/ca-trust/passwords/default/keystore"
122-
logDebug(s"Requesting Cert Pass: $certPassVaultPath")
123-
val requestUrl = s"$vaultUrl/$certPassVaultPath"
124-
HTTPHelper.executeGet(requestUrl,
125-
"data", Some(Seq(("X-Vault-Token", token))))("pass").asInstanceOf[String]
126-
}
127-
128104
def getCertPassForAppFromVault(vaultUrl: String,
129105
appPassVaulPath: String,
130106
token: String): String = {
@@ -146,15 +122,6 @@ object VaultHelper extends Logging {
146122
(key, certs)
147123
}
148124

149-
def getPassForAppFromVault(vaultUrl: String,
150-
vaultPath: String,
151-
token: String): String = {
152-
logDebug(s"Requesting Pass for App: $vaultPath")
153-
val requestUrl = s"$vaultUrl/$vaultPath"
154-
HTTPHelper.executeGet(requestUrl,
155-
"data", Some(Seq(("X-Vault-Token", token))))("token").asInstanceOf[String]
156-
}
157-
158125
def getRealToken(vaultUrl: String, token: String): String = {
159126
val requestUrl = s"$vaultUrl/v1/sys/wrapping/unwrap"
160127
logDebug(s"Requesting real Token: $requestUrl")

0 commit comments

Comments
 (0)