Skip to content

Commit

Permalink
Revert "Adding Logs to record behaviour"
Browse files Browse the repository at this point in the history
This reverts commit 61db350.
  • Loading branch information
Vagoasdf committed Dec 5, 2024
1 parent 61db350 commit e83a24e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
11 changes: 1 addition & 10 deletions src/fides/api/api/v1/endpoints/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ def patch_connections(
Otherwise, a new ConnectionConfiguration will be created for you.
"""
system = get_system(db, fides_key)
logger.info("Patching connection configs for system '{}'", system.fides_key)
logger.debug("Connection configs: {}", configs[0].secrets)
return patch_connection_configs(db, configs, system)


Expand Down Expand Up @@ -174,9 +172,6 @@ def patch_connection_secrets(
connection_config: ConnectionConfig = get_connection_config_or_error(
db, system.connection_configs.key
)
logger.info(f"Oauth Log: For Key '{connection_config.key}'. secrets: {connection_config.secrets}")
logger.info(f"Oauth Log: unvalidated_secrets: {unvalidated_secrets}")

# Inserts unchanged sensitive values. The FE does not send masked values sensitive secrets.
if connection_config.secrets is not None:
for key, value in connection_config.secrets.items():
Expand All @@ -192,20 +187,16 @@ def patch_connection_secrets(
db, unvalidated_secrets, connection_config
).model_dump(mode="json")

logger.info(f"Oauth Log: validated_secrets: {validated_secrets}")


for key, value in validated_secrets.items():
connection_config.secrets[key] = value # type: ignore

# Deauthorize an OAuth connection when the secrets are updated. This is necessary because
# the existing access tokens may not be valid anymore. This only applies to SaaS connection
# configurations that uses an Oauth authentication strategy.
# configurations that use the "oauth2_authorization_code" authentication strategy.
if (
connection_config.authorized
and connection_config.connection_type == ConnectionType.saas
):
logger.info(f"Removing access Token {connection_config.secrets['access_token']}")
del connection_config.secrets["access_token"]

# Save validated secrets, regardless of whether they've been verified.
Expand Down
4 changes: 0 additions & 4 deletions src/fides/api/util/connection_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def patch_connection_configs(

if config.connection_type == "saas":
if config.secrets:
logger.info("Oauth Log: Registered New Config Secrets")
# This is here rather than with the get_connection_config_or_error because
# it will also throw an HTTPException if validation fails and we don't want
# to catch it in this case.
Expand All @@ -181,8 +180,6 @@ def patch_connection_configs(
db, config.secrets, existing_connection_config
)
else:
# Refactor idea: Transform this into a function for readability
logger.info("Oauth Log: Into Non existing connection config branch")
if not config.saas_connector_type:
raise HTTPException(
status_code=HTTP_422_UNPROCESSABLE_ENTITY,
Expand Down Expand Up @@ -255,7 +252,6 @@ def patch_connection_configs(
config_dict = config.model_dump(serialize_as_any=True, exclude_unset=True)
config_dict.pop("saas_connector_type", None)


if existing_connection_config:
config_dict = {
key: value
Expand Down

0 comments on commit e83a24e

Please sign in to comment.