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


##########
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:
   @jnturton This is actually addressed in 
https://github.com/apache/drill/pull/2544.   I refactored the OAuth stuff so 
that if other plugins needed to use OAuth, they can reuse almost all of what 
Drill already does.



-- 
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: dev-unsubscr...@drill.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to