use of org.apache.drill.exec.store.security.oauth.OAuthTokenCredentials in project drill by apache.
the class PluginConfigWrapper method isOauth.
/**
* Determines whether the storage plugin in question needs the OAuth button in the UI. In
* order to be considered an OAuth plugin, the plugin must:
* 1. Use AbstractSecuredStoragePluginConfig
* 2. The credential provider must not be null
* 3. The credentialsProvider must contain a client_id and client_secret
* @return true if the plugin uses OAuth, false if not.
*/
@JsonIgnore
public boolean isOauth() {
if (!(config instanceof AbstractSecuredStoragePluginConfig)) {
return false;
}
AbstractSecuredStoragePluginConfig securedStoragePluginConfig = (AbstractSecuredStoragePluginConfig) config;
CredentialsProvider credentialsProvider = securedStoragePluginConfig.getCredentialsProvider();
if (credentialsProvider == null) {
return false;
}
OAuthTokenCredentials tokenCredentials = new OAuthTokenCredentials(credentialsProvider);
return !StringUtils.isEmpty(tokenCredentials.getClientID()) || !StringUtils.isEmpty(tokenCredentials.getClientSecret());
}
Aggregations