vvysotskyi commented on code in PR #2547:
URL: https://github.com/apache/drill/pull/2547#discussion_r872035428


##########
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java:
##########
@@ -276,24 +280,24 @@ public Response updateAccessToken(@PathParam("name") 
String name, OAuthTokenCont
   public Response updateOAuthTokens(@PathParam("name") String name,
                                     OAuthTokenContainer tokenContainer) {
     try {
-      if (storage.getPlugin(name).getConfig() instanceof 
CredentialedStoragePluginConfig) {
-        DrillbitContext context = ((AbstractStoragePlugin) 
storage.getPlugin(name)).getContext();
-        OAuthTokenProvider tokenProvider = context.getoAuthTokenProvider();
-        PersistentTokenTable tokenTable = 
tokenProvider.getOauthTokenRegistry().getTokenTable(name);
-
-        // Set the access and refresh token
-        tokenTable.setAccessToken(tokenContainer.getAccessToken());
-        tokenTable.setRefreshToken(tokenContainer.getRefreshToken());
-
-        return Response.status(Status.OK)
-          .entity("Access tokens have been updated.")
-          .build();
-      } else {
+      StoragePluginConfig config = storage.getPlugin(name).getConfig();
+      if (config.getValue("type") != "http") {

Review Comment:
   The intention was to allow it not only for HTTP but for all other plugins 
that have `CredentialedStoragePluginConfig`, so they theoretically can also use 
OAuth and update tokens.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to