vvysotskyi commented on a change in pull request #2401:
URL: https://github.com/apache/drill/pull/2401#discussion_r786152757



##########
File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
##########
@@ -62,6 +72,10 @@
 @RolesAllowed(ADMIN_ROLE)
 public class StorageResources {
   private static final Logger logger = 
LoggerFactory.getLogger(StorageResources.class);
+  private static final String OAUTH_SUCCESS = "<html>\n" + "<head>\n" + "  
<title>Success!</title>\n" + "  <link rel=\"shortcut icon\" 
href=\"/static/img/drill.ico\">\n" + "  " +

Review comment:
       Please move to the file and use ftl template as it is done for all other 
UI stuff.

##########
File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
##########
@@ -180,6 +194,47 @@ public Response enablePlugin(@PathParam("name") String 
name, @PathParam("val") B
     }
   }
 
+  @GET
+  @Path("/storage/{name}/update_oath2_authtoken")
+  @Produces(MediaType.TEXT_HTML)
+  public Response updateAuthToken(@PathParam("name") String name, 
@QueryParam("code") String code) {
+    try {
+      if 
(storage.getPlugin(name).getConfig().getClass().getSimpleName().equalsIgnoreCase("HttpStoragePluginConfig"))
 {

Review comment:
       Let's remove this check for `HttpStoragePluginConfig`, and add only 
check that plugin config is an instance of 
`AbstractSecuredStoragePluginConfig`. Theoretically, there might be other 
plugins that might want to use this functionality.

##########
File path: exec/java-exec/src/main/resources/rest/storage/update.ftl
##########
@@ -43,6 +44,10 @@
     <#else>
       <a id="enabled" class="btn btn-success text-white">Enable</a>
     </#if>
+    <#if model.getType() == "HttpStoragePluginConfig" >
+    <! -- TODO Also check to see whether the plugin uses OAuth or not -->

Review comment:
       I think it makes sense to add some method to `StoragePlugin` or 
`StoragePluginConfig` to check whether it supports OAuth.

##########
File path: 
contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/HttpOAuthConfig.java
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.drill.exec.store.http;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.Map;
+
+@Slf4j
+@ToString
+@Getter
+@Setter
+@Builder
+@EqualsAndHashCode
+@JsonInclude(JsonInclude.Include.NON_DEFAULT)
+@JsonDeserialize(builder = HttpOAuthConfig.HttpOAuthConfigBuilder.class)
+public class HttpOAuthConfig {

Review comment:
       I don't see the place where this class is actually used...




-- 
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