-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Source TikTok Marketing : Access token is null #14299 #14461
Merged
alexandr-shegeda
merged 9 commits into
master
from
osheg/bug-with-json-secrets-replacement
Jul 13, 2022
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
12c100a
Replaced List with Set in order to avoid credentials loosing for case…
alexandr-shegeda faf0e63
returned back List to save the order of fields, added distinct() to h…
alexandr-shegeda b090bd3
clean up
alexandr-shegeda da14684
Merge branch 'master' into osheg/bug-with-json-secrets-replacement
kimerinn 38c0a3c
[14299] Source TikTok Marketing : Access token is null
alexandr-shegeda f2b5765
Merge remote-tracking branch 'origin/osheg/bug-with-json-secrets-repl…
alexandr-shegeda eb90680
Merge branch 'master' into osheg/bug-with-json-secrets-replacement
alexandr-shegeda 4955a0f
[14299] Source TikTok Marketing : Access token is null
alexandr-shegeda fb73ca1
Format
benmoriceau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...test/java/io/airbyte/config/persistence/split_secrets/test_cases/OneOfSecretTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.config.persistence.split_secrets.test_cases; | ||
|
||
import io.airbyte.config.persistence.split_secrets.SecretCoordinate; | ||
import io.airbyte.config.persistence.split_secrets.SecretPersistence; | ||
import io.airbyte.config.persistence.split_secrets.SecretsHelpersTest; | ||
import io.airbyte.config.persistence.split_secrets.SecretsTestCase; | ||
import java.util.Map; | ||
import java.util.function.Consumer; | ||
|
||
public class OneOfSecretTestCase implements SecretsTestCase { | ||
|
||
@Override | ||
public String getName() { | ||
return "oneof_secret"; | ||
} | ||
|
||
@Override | ||
public Map<SecretCoordinate, String> getFirstSecretMap() { | ||
return Map.of( | ||
new SecretCoordinate(PREFIX + SecretsHelpersTest.WORKSPACE_ID + SECRET + SecretsHelpersTest.UUIDS.get(0), 1), "access_token_1", | ||
new SecretCoordinate(PREFIX + SecretsHelpersTest.WORKSPACE_ID + SECRET + SecretsHelpersTest.UUIDS.get(1), 1), "clientId_1", | ||
new SecretCoordinate(PREFIX + SecretsHelpersTest.WORKSPACE_ID + SECRET + SecretsHelpersTest.UUIDS.get(2), 1), "client_secret_1", | ||
new SecretCoordinate(PREFIX + SecretsHelpersTest.WORKSPACE_ID + SECRET + SecretsHelpersTest.UUIDS.get(3), 1), "refresh_token_1"); | ||
} | ||
|
||
@Override | ||
public Map<SecretCoordinate, String> getSecondSecretMap() { | ||
return Map.of( | ||
new SecretCoordinate(PREFIX + SecretsHelpersTest.WORKSPACE_ID + SECRET + SecretsHelpersTest.UUIDS.get(0), 2), "access_token_2"); | ||
} | ||
|
||
@Override | ||
public Consumer<SecretPersistence> getPersistenceUpdater() { | ||
return secretPersistence -> { | ||
secretPersistence.write( | ||
new SecretCoordinate(PREFIX + SecretsHelpersTest.WORKSPACE_ID + SECRET + SecretsHelpersTest.UUIDS.get(0), 1), | ||
"access_token_1"); | ||
secretPersistence.write( | ||
new SecretCoordinate(PREFIX + SecretsHelpersTest.WORKSPACE_ID + SECRET + SecretsHelpersTest.UUIDS.get(1), 1), | ||
"clientId_1"); | ||
secretPersistence.write( | ||
new SecretCoordinate(PREFIX + SecretsHelpersTest.WORKSPACE_ID + SECRET + SecretsHelpersTest.UUIDS.get(2), 1), | ||
"client_secret_1"); | ||
secretPersistence.write( | ||
new SecretCoordinate(PREFIX + SecretsHelpersTest.WORKSPACE_ID + SECRET + SecretsHelpersTest.UUIDS.get(3), 1), | ||
"refresh_token_1"); | ||
}; | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
airbyte-config/config-persistence/src/test/resources/oneof_secret/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"credentials": { | ||
"auth_method": "oauth2.0", | ||
"client_id" : "**********", | ||
"client_secret": "**********", | ||
"access_token": "**********", | ||
"refresh_token": "**********" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
airbyte-config/config-persistence/src/test/resources/oneof_secret/expectedPaths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$.credentials.access_token;$.credentials.client_id;$.credentials.client_secret;$.credentials.refresh_token; |
9 changes: 9 additions & 0 deletions
9
airbyte-config/config-persistence/src/test/resources/oneof_secret/full_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"credentials": { | ||
"auth_method": "oauth2.0", | ||
"client_id" : "clientId_1", | ||
"client_secret": "client_secret_1", | ||
"access_token": "access_token_1", | ||
"refresh_token": "refresh_token_1" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
airbyte-config/config-persistence/src/test/resources/oneof_secret/partial_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"credentials": { | ||
"auth_method": "oauth2.0", | ||
"client_id": { | ||
"_secret": "airbyte_workspace_e0eb0554-ffe0-4e9c-9dc0-ed7f52023eb2_secret_2c2ef2b3-259a-4e73-96d1-f56dacee2e5e_v1" | ||
}, | ||
"client_secret": { | ||
"_secret": "airbyte_workspace_e0eb0554-ffe0-4e9c-9dc0-ed7f52023eb2_secret_1206db5b-b968-4df1-9a76-f3fcdae7e307_v1" | ||
}, | ||
"access_token": { | ||
"_secret": "airbyte_workspace_e0eb0554-ffe0-4e9c-9dc0-ed7f52023eb2_secret_9eba44d8-51e7-48f1-bde2-619af0e42c22_v1" | ||
}, | ||
"refresh_token": { | ||
"_secret": "airbyte_workspace_e0eb0554-ffe0-4e9c-9dc0-ed7f52023eb2_secret_c03ef566-79a7-4e77-b6f3-d23d2528f25a_v1" | ||
} | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
airbyte-config/config-persistence/src/test/resources/oneof_secret/spec.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"credentials": { | ||
"title": "Authorization Method", | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"title": "OAuth2.0", | ||
"required": [ | ||
"client_id", | ||
"client_secret", | ||
"access_token", | ||
"refresh_token" | ||
], | ||
"properties": { | ||
"auth_method": { | ||
"type": "string", | ||
"const": "oauth2.0", | ||
"enum": ["oauth2.0"], | ||
"default": "oauth2.0", | ||
"order": 0 | ||
}, | ||
"client_id": { | ||
"type": "string", | ||
"title": "Client ID", | ||
"description": "The Client ID of your application.", | ||
"airbyte_secret": true | ||
}, | ||
"client_secret": { | ||
"type": "string", | ||
"title": "Client Secret", | ||
"description": "The Client Secret of your application.", | ||
"airbyte_secret": true | ||
}, | ||
"access_token": { | ||
"type": "string", | ||
"title": "Access Token", | ||
"description": "Access Token for making authenticated requests.", | ||
"airbyte_secret": true | ||
}, | ||
"refresh_token": { | ||
"type": "string", | ||
"title": "Refresh Token", | ||
"description": "Refresh Token to renew the expired Access Token.", | ||
"default": "", | ||
"airbyte_secret": true | ||
} | ||
} | ||
}, | ||
{ | ||
"title": "Access Token", | ||
"type": "object", | ||
"required": ["access_token"], | ||
"properties": { | ||
"auth_method": { | ||
"type": "string", | ||
"const": "access_token", | ||
"enum": ["access_token"], | ||
"default": "access_token", | ||
"order": 0 | ||
}, | ||
"access_token": { | ||
"type": "string", | ||
"title": "Access Token", | ||
"airbyte_secret": true | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
airbyte-config/config-persistence/src/test/resources/oneof_secret/update_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"credentials": { | ||
"auth_method": "access_token", | ||
"access_token": "access_token_2" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...yte-config/config-persistence/src/test/resources/oneof_secret/updated_partial_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"credentials": { | ||
"auth_method": "access_token", | ||
"access_token": { | ||
"_secret": "airbyte_workspace_e0eb0554-ffe0-4e9c-9dc0-ed7f52023eb2_secret_9eba44d8-51e7-48f1-bde2-619af0e42c22_v2" | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can you add a unit test for this?
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.
added unit tests. will attach screenshots with failed tests without this change
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.
can you add in the javadoc comment that it will not return duplicates?
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.
added javadoc