Skip to content

Commit

Permalink
adds sensitive fields in external connector credential.
Browse files Browse the repository at this point in the history
changes connectorType in ExternalConnectorCredentialId from string to AbstractConnectorType.
  • Loading branch information
stthanos committed Jan 29, 2024
1 parent a5e5bf9 commit 57f960a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions snapi-frontend/src/main/scala/raw/creds/api/Credentials.scala
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,18 @@ final case class SnowflakeCredential(
val port = None
}

case class ExternalConnectorCredentialId(name: String, connectorType: String)
case class ExternalConnectorCredentialId(name: String, connectorType: AbstractConnectorType)

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "repr")
@JsonSubTypes(
Array(
new JsonType(value = classOf[SalesforceConnectorType], name = "SALESFORCE")
)
)
trait AbstractConnectorType {
def repr: String
}
case object SalesforceConnectorType extends AbstractConnectorType {
case class SalesforceConnectorType() extends AbstractConnectorType {
override def repr: String = "SALESFORCE"
}

Expand All @@ -163,6 +169,7 @@ case object SalesforceConnectorType extends AbstractConnectorType {
)
sealed trait ExternalConnectorCredential extends Credential {
def connectorType: AbstractConnectorType
def sensitiveFields: List[String]
}

final case class ExternalConnectorSalesforceCredential(
Expand All @@ -172,9 +179,10 @@ final case class ExternalConnectorSalesforceCredential(
securityToken: String,
clientId: String,
apiVersion: String,
customObjects: Seq[String]
customObjects: Seq[String],
override val sensitiveFields: List[String] = List("password", "securityToken")
) extends ExternalConnectorCredential {
override def connectorType: AbstractConnectorType = SalesforceConnectorType
override def connectorType: AbstractConnectorType = SalesforceConnectorType()
}

final case class Secret(name: String, value: String) extends Credential
Expand Down

0 comments on commit 57f960a

Please sign in to comment.