in server/src/main/kotlin/org/jetbrains/teamcity/vault/server/VaultConnector.kt [253:274]
fun performLoginRequest(
template: RestTemplate,
method: AuthMethod,
path: String,
body: Map<String, String>,
maskingValue: String,
extractor: (VaultResponse) -> Pair<String, String>
): Pair<String, String> =
try {
val errorMessage = "HashiCorp Vault hasn't returned anything from POST to '$path'"
val vaultResponse = retrier.execute(Callable {
template.write(path, body)
?: throw VaultException(errorMessage)
}) ?: throw VaultException(errorMessage)
extractor(vaultResponse)
} catch (e: VaultException) {
val cause = e.cause
if (cause is HttpStatusCodeException) {
throw getReadableException(cause, method) { it.replace(maskingValue, "*******") }
}
throw e
}