Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC9B310850 for ; Thu, 27 Mar 2014 21:44:29 +0000 (UTC) Received: (qmail 93136 invoked by uid 500); 27 Mar 2014 21:44:26 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 92971 invoked by uid 500); 27 Mar 2014 21:44:20 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 92942 invoked by uid 99); 27 Mar 2014 21:44:20 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2014 21:44:20 +0000 Date: Thu, 27 Mar 2014 21:44:19 +0000 (UTC) From: "Jing Zhao (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (HDFS-4564) Webhdfs returns incorrect http response codes for denied operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-4564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13949977#comment-13949977 ] Jing Zhao edited comment on HDFS-4564 at 3/27/14 9:43 PM: ---------------------------------------------------------- # Why do we want to do this extra check for 401? {code} + // server is demanding an authentication we don't support + if (code == HttpURLConnection.HTTP_UNAUTHORIZED) { + throw new IOException( + new AuthenticationException(conn.getResponseMessage())); + } {code} # I think the following check should be included in the shouldRetry method. {code} + Throwable cause = ioe.getCause(); + if (cause != null && cause instanceof AuthenticationException) { + throw ioe; // no retries for auth failures + } {code} # I guess the checkTGTAndReloginFromKeytab has been covered by the current code? In the current implementation, before every operation webhdfsfs first calls ensureTokenInitialized which fetches token if necessary. And in this process before we open the connection, checkTGTAndReloginFromKeytab is called if necessary. See URLConnectionFactory#openConnection(URL, boolean). If we want to change this mechanism, I think we should open a separate jira to do it. {code} + if (op.getRequireAuth()) { + connectUgi.checkTGTAndReloginFromKeytab(); + } {code} was (Author: jingzhao): # Why do we want to do this extra check for 401? {code} + // server is demanding an authentication we don't support + if (code == HttpURLConnection.HTTP_UNAUTHORIZED) { + throw new IOException( + new AuthenticationException(conn.getResponseMessage())); + } {code} # I think the following check should be included in the shouldRetry method. {code} + Throwable cause = ioe.getCause(); + if (cause != null && cause instanceof AuthenticationException) { + throw ioe; // no retries for auth failures + } {code} # I guess the checkTGTAndReloginFromKeytab has been covered by the current code? In the current implementation, before everywebhdfsfs first calls ensureTokenInitialized which fetches token if necessary. And in this process before we open the connection, checkTGTAndReloginFromKeytab is called if necessary. See URLConnectionFactory#openConnection(URL, boolean). If we want to change this mechanism, I think we should open a separate jira to do it. {code} + if (op.getRequireAuth()) { + connectUgi.checkTGTAndReloginFromKeytab(); + } {code} > Webhdfs returns incorrect http response codes for denied operations > ------------------------------------------------------------------- > > Key: HDFS-4564 > URL: https://issues.apache.org/jira/browse/HDFS-4564 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: webhdfs > Affects Versions: 0.23.0, 2.0.0-alpha, 3.0.0 > Reporter: Daryn Sharp > Assignee: Daryn Sharp > Priority: Blocker > Attachments: HDFS-4564.branch-23.patch, HDFS-4564.branch-23.patch, HDFS-4564.branch-23.patch, HDFS-4564.patch, HDFS-4564.patch > > > Webhdfs is returning 401 (Unauthorized) instead of 403 (Forbidden) when it's denying operations. Examples including rejecting invalid proxy user attempts and renew/cancel with an invalid user. -- This message was sent by Atlassian JIRA (v6.2#6252)