You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by yj...@apache.org on 2015/06/19 23:37:20 UTC
hadoop git commit: HADOOP-12103. Small refactoring of
DelegationTokenAuthenticationFilter to allow code sharing. Contributed by
Yongjun Zhang.
Repository: hadoop
Updated Branches:
refs/heads/trunk b42f1ec13 -> 49f5d20ef
HADOOP-12103. Small refactoring of DelegationTokenAuthenticationFilter to allow code sharing. Contributed by Yongjun Zhang.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/49f5d20e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/49f5d20e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/49f5d20e
Branch: refs/heads/trunk
Commit: 49f5d20efe7af7cd7c45d93edad33997a695a746
Parents: b42f1ec
Author: Yongjun Zhang <yz...@cloudera.com>
Authored: Fri Jun 19 14:06:17 2015 -0700
Committer: Yongjun Zhang <yz...@cloudera.com>
Committed: Fri Jun 19 14:06:17 2015 -0700
----------------------------------------------------------------------
hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++
.../web/DelegationTokenAuthenticationFilter.java | 16 +++++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/49f5d20e/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 2f5eda3..e1d9ca9 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -878,6 +878,9 @@ Release 2.7.1 - UNRELEASED
IMPROVEMENTS
+ HADOOP-12103. Small refactoring of DelegationTokenAuthenticationFilter to
+ allow code sharing. (Yongjun Zhang)
+
OPTIMIZATIONS
BUG FIXES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/49f5d20e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticationFilter.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticationFilter.java
index b6e1a76..af66ee5 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticationFilter.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/web/DelegationTokenAuthenticationFilter.java
@@ -115,7 +115,22 @@ public class DelegationTokenAuthenticationFilter
protected Properties getConfiguration(String configPrefix,
FilterConfig filterConfig) throws ServletException {
Properties props = super.getConfiguration(configPrefix, filterConfig);
+ setAuthHandlerClass(props);
+ return props;
+ }
+
+ /**
+ * Set AUTH_TYPE property to the name of the corresponding authentication
+ * handler class based on the input properties.
+ * @param props input properties.
+ */
+ protected void setAuthHandlerClass(Properties props)
+ throws ServletException {
String authType = props.getProperty(AUTH_TYPE);
+ if (authType == null) {
+ throw new ServletException("Config property "
+ + AUTH_TYPE + " doesn't exist");
+ }
if (authType.equals(PseudoAuthenticationHandler.TYPE)) {
props.setProperty(AUTH_TYPE,
PseudoDelegationTokenAuthenticationHandler.class.getName());
@@ -123,7 +138,6 @@ public class DelegationTokenAuthenticationFilter
props.setProperty(AUTH_TYPE,
KerberosDelegationTokenAuthenticationHandler.class.getName());
}
- return props;
}
/**