-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bmoric/add fetch source schema in oauth #19392
Conversation
…-fetch-source-schema-in-oauth
Trying to test it on my local at the moment. |
airbyte-server/src/main/java/io/airbyte/server/handlers/OAuthHandler.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/handlers/OAuthHandler.java
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/handlers/OAuthHandler.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a few comments. Most important is the last one, where I ask about if we are using the right OAuth field in the connector spec
this.configRepository = configRepository; | ||
this.oAuthImplementationFactory = new OAuthImplementationFactory(configRepository, httpClient); | ||
this.trackingClient = trackingClient; | ||
this.secretsRepositoryReader = secretsRepositoryReader; | ||
} | ||
|
||
public OAuthConsentRead getSourceOAuthConsent(final SourceOauthConsentRequest sourceDefinitionIdRequestBody) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't introduced by this PR, but this parameter should probably be named something like sourceOauthConsentRequestBody
instead of sourceDefinitionIdRequestBody
. Same for the destination method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Jsons.deserializeToStringMap(oAuthInputConfigurationFromInput) | ||
.forEach((k, v) -> { | ||
if (AirbyteSecretConstants.SECRETS_MASK.equals(v)) { | ||
result.put(k, oAuthInputConfigurationFromDB.get(k).textValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we guaranteed that oAuthInputConfigurationFromDB
will always have an entry for each key here? If not, this could result in an NPE, so we should probably handle that case explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. I will add a check in case if it is null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
List<String> fieldsToGet = | ||
buildJsonPathFromOAuthFlowInitParameters(spec.getAuthSpecification().getOauth2Specification().getOauthFlowInitParameters()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we pulling these fields from the spec.getAuthSpecification()
? Isn't that the old/legacy way of configuring OAuth?
The if-statement above which does OAuthConfigSupplier.hasOAuthConfigSpecification(spec)
is checking if advancedAuth
is set on the spec, which is the new way of configuring OAuth. So it seems like we shouldn't be accessing the legacy auth config fields here right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, Unfortunatelly spec.getAdvancedAuth().getOauthConfigSpecification().getOauthUserInputFromConnectorConfigSpecification()
is a Json object. I will have to parse it based on the description...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
moving back to draft in order to address comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more small comment, otherwise this looks fine to me
@@ -195,6 +237,19 @@ public void setDestinationInstancewideOauthParams(final SetInstancewideDestinati | |||
configRepository.writeDestinationOAuthParam(param); | |||
} | |||
|
|||
private JsonNode getOAuthInputConfigurationForConsent(final ConnectorSpecification spec, | |||
final JsonNode hydratedSourceConnectionConfiguration, | |||
final JsonNode destinationDefinitionIdRequestBody) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename this last parameter to oAuthInputConfiguration, since this current parameter name is not really quite right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This reverts commit a968078.
* Update inputs * PR comments and autogen files * Fix oAuth retry * Handle null * Add missing ; * PR comments * use advanced oAuth * PR comments * More PR comments * Format * Avoid conflict in json extract * Format
What
Address https://github.com/airbytehq/oncall/issues/999. If in the oAuth config alreay exist in the DB, and is not updated, we are using it.