Pārlūkot izejas kodu

HADOOP-7509. Improve exception message thrown when Authentication is required. Contributed by Ravi Prakash.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security@1182642 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 14 gadi atpakaļ
vecāks
revīzija
f47ab32f73
2 mainītis faili ar 10 papildinājumiem un 2 dzēšanām
  1. 3 0
      CHANGES.txt
  2. 7 2
      src/core/org/apache/hadoop/ipc/Server.java

+ 3 - 0
CHANGES.txt

@@ -35,6 +35,9 @@ Release 0.20.206.0 - unreleased
     HDFS-2332. Add test for HADOOP-7629 (using an immutable FsPermission
     object as an RPC parameter fails). (todd)
 
+    HADOOP-7509. Improve exception message thrown when Authentication is 
+    required. (Ravi Prakash via suresh)
+
 Release 0.20.205.0 - unreleased
 
   NEW FEATURES

+ 7 - 2
src/core/org/apache/hadoop/ipc/Server.java

@@ -62,6 +62,7 @@ import javax.security.sasl.SaslServer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.apache.hadoop.io.BytesWritable;
 import org.apache.hadoop.io.IntWritable;
 import static org.apache.hadoop.fs.CommonConfigurationKeys.*;
@@ -1123,8 +1124,12 @@ public abstract class Server {
             throw new IOException("Unable to read authentication method");
           }
           if (isSecurityEnabled && authMethod == AuthMethod.SIMPLE) {
-            AccessControlException ae = new AccessControlException(
-                "Authentication is required");
+            AccessControlException ae = new AccessControlException("Authorization ("
+              + CommonConfigurationKeys.HADOOP_SECURITY_AUTHENTICATION
+              + ") is enabled but authentication ("
+              + CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION
+              + ") is configured as simple. Please configure another method "
+              + "like kerberos or digest.");
             setupResponse(authFailedResponse, authFailedCall, Status.FATAL,
                 null, ae.getClass().getName(), ae.getMessage());
             responder.doRespond(authFailedCall);