[ 
https://issues.apache.org/jira/browse/DRILL-8220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17537463#comment-17537463
 ] 

ASF GitHub Bot commented on DRILL-8220:
---------------------------------------

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.





> Add User Translation Support for OAuth Enabled Plugins
> ------------------------------------------------------
>
>                 Key: DRILL-8220
>                 URL: https://issues.apache.org/jira/browse/DRILL-8220
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Storage - Other
>    Affects Versions: 1.20.0
>            Reporter: Charles Givre
>            Assignee: Charles Givre
>            Priority: Major
>             Fix For: 2.0.0
>
>
> This PR adds support for individual users to provide their own credentials 
> for plugins that use OAuth 2.0 as a means of authorization and 
> authentication.   Currently, only the HTTP storage plugin supports OAuth, 
> however, this PR moves some of the core features out of the HTTP plugin so 
> that other plugins can access this. 



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to