Skip to content

Commit

Permalink
Merge pull request cdapio#15399 from cdapio/bugfix/CDAP-20867-reduce-…
Browse files Browse the repository at this point in the history
…secure-calls-oauth

CDAP-20867 switch to cheaper secure store call in oauth handler
  • Loading branch information
albertshau authored Nov 1, 2023
2 parents 7e9946b + de814cb commit 50621d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String evaluate(String macroFunction, String... arguments) throws Invalid
throw new InvalidMacroException("Secure store macro function only supports 1 argument.");
}
try {
return Bytes.toString(secureStore.get(namespace, arguments[0]).get());
return Bytes.toString(secureStore.getData(namespace, arguments[0]));
} catch (Exception e) {
throw new InvalidMacroException(
"Failed to resolve macro '" + macroFunction + "(" + arguments[0] + ")'", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public Optional<OAuthProvider> getProvider(String name) throws OAuthStoreExcepti
OAuthClientCredentials clientCreds;
try {
String clientCredsJson = new String(
secureStore.get(NamespaceId.SYSTEM.getNamespace(), getClientCredsKey(name)).get(),
secureStore.getData(NamespaceId.SYSTEM.getNamespace(), getClientCredsKey(name)),
StandardCharsets.UTF_8);
clientCreds = GSON.fromJson(clientCredsJson, OAuthClientCredentials.class);
} catch (IOException e) {
Expand Down Expand Up @@ -171,7 +171,7 @@ public Optional<OAuthRefreshToken> getRefreshToken(String oauthProvider, String
throws OAuthStoreException {
try {
String tokenJson = new String(
secureStore.get(NamespaceId.SYSTEM.getNamespace(), getRefreshTokenKey(oauthProvider, credentialId)).get(),
secureStore.getData(NamespaceId.SYSTEM.getNamespace(), getRefreshTokenKey(oauthProvider, credentialId)),
StandardCharsets.UTF_8);
return Optional.of(GSON.fromJson(tokenJson, OAuthRefreshToken.class));
} catch (IOException e) {
Expand Down

0 comments on commit 50621d8

Please sign in to comment.