in common/src/main/kotlin/org/jetbrains/teamcity/vault/VaultFeatureSettings.kt [91:107]
fun getAgentAuthFromProperties(map: Map<String, String>): Auth {
val kind = (map[VaultConstants.FeatureSettings.AUTH_METHOD]
?: VaultConstants.FeatureSettings.DEFAULT_AUTH_METHOD)
return when (kind) {
AuthMethod.APPROLE.id -> {
AppRoleAuthAgent(map[VaultConstants.FeatureSettings.WRAPPED_TOKEN] ?: "")
}
AuthMethod.LDAP.id -> LdapAgent(
map[VaultConstants.FeatureSettings.WRAPPED_TOKEN] ?: ""
)
AuthMethod.GCP_IAM.id -> toGcpIamProperties(map)
else -> error("Unexpected auth method '$kind'")
}
}