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


##########
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/PluginConfigWrapper.java:
##########
@@ -114,4 +125,75 @@ public boolean isOauth() {
 
     return 
tokenCredentials.map(OAuthTokenCredentials::getClientID).orElse(null) != null;
   }
+
+  @JsonIgnore
+  public String getClientID() {
+    CredentialedStoragePluginConfig securedStoragePluginConfig = 
(CredentialedStoragePluginConfig) config;
+    CredentialsProvider credentialsProvider = 
securedStoragePluginConfig.getCredentialsProvider();
+
+    return credentialsProvider.getCredentials().getOrDefault("clientID", "");
+  }
+
+  /**
+   * This function generates the authorization URI for use when a non-admin 
user is authorizing
+   * OAuth2.0 access for a storage plugin.  This function is necessary as we 
do not wish to expose
+   * any plugin configuration information to the user.
+   *
+   * If the plugin is not OAuth, or is missing components, the function will 
return an empty string.
+   * @return The authorization URI for an OAuth enabled plugin.
+   */
+  @JsonIgnore
+  public String getAuthorizationURIWithParams() {

Review Comment:
   Sounds good.  Just be aware that this code is used in the `list.ftl` for the 
Credentials page.



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