You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2020/02/14 10:26:40 UTC

[GitHub] [hadoop] snvijaya commented on a change in pull request #1842: HADOOP-16730 : ABFS: Add Authorizer Interface

snvijaya commented on a change in pull request #1842: HADOOP-16730 : ABFS: Add Authorizer Interface
URL: https://github.com/apache/hadoop/pull/1842#discussion_r379356145
 
 

 ##########
 File path: hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java
 ##########
 @@ -578,21 +587,30 @@ public AccessTokenProvider getTokenProvider() throws TokenAccessProviderExceptio
     }
   }
 
-  public String getAbfsExternalAuthorizationClass() {
-    return this.abfsExternalAuthorizationClass;
-  }
+  public AbfsAuthorizer getAbfsAuthorizer() throws AzureBlobFileSystemException {
+    if (this.authorizer != null)
+    {
+      return this.authorizer;
+    }
 
-  public AbfsAuthorizer getAbfsAuthorizer() throws IOException {
-    String authClassName = getAbfsExternalAuthorizationClass();
-    AbfsAuthorizer authorizer = null;
+    String authClassName = this.abfsAuthorizerClass;
 
     try {
       if (authClassName != null && !authClassName.isEmpty()) {
         @SuppressWarnings("unchecked")
         Class<AbfsAuthorizer> authClass = (Class<AbfsAuthorizer>) rawConfig.getClassByName(authClassName);
-        authorizer = authClass.getConstructor(new Class[] {Configuration.class}).newInstance(rawConfig);
+        this.authorizer =
+            authClass.getConstructor(new Class[] {Configuration.class}).newInstance(rawConfig);
         LOG.trace("Initializing {}", authClassName);
-        authorizer.init();
+        this.authorizer.init();
+        if ((this.authorizer.getAuthType() != AuthType.SAS) && (
+            this.authorizer.getAuthType() != AuthType.None)) {
+          throw new AbfsAuthorizationException(
 
 Review comment:
   Currently the only supported AuthType for an external Authorizer is SAS. Throwing the exception if AuthType is set to any other such as OAuth or SharedKey right after the authorizer init.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org