5656import org .apache .hadoop .hbase .http .log .LogLevel ;
5757import org .apache .hadoop .hbase .util .ReflectionUtils ;
5858import org .apache .hadoop .hbase .util .Threads ;
59+ import org .apache .hadoop .security .AuthenticationFilterInitializer ;
5960import org .apache .hadoop .security .SecurityUtil ;
6061import org .apache .hadoop .security .UserGroupInformation ;
6162import org .apache .hadoop .security .authentication .server .AuthenticationFilter ;
@@ -143,6 +144,7 @@ public class HttpServer implements FilterContainer {
143144 HTTP_SPNEGO_AUTHENTICATION_PREFIX + "admin.groups" ;
144145 public static final String HTTP_PRIVILEGED_CONF_KEY =
145146 "hbase.security.authentication.ui.config.protected" ;
147+ public static final String HTTP_UI_NO_CACHE_ENABLE_KEY = "hbase.http.filter.no-store.enable" ;
146148 public static final boolean HTTP_PRIVILEGED_CONF_DEFAULT = false ;
147149
148150 // The ServletContext attribute where the daemon Configuration
@@ -679,7 +681,7 @@ private static WebAppContext createWebAppContext(String name, Configuration conf
679681 ctx .getServletContext ().setAttribute (org .apache .hadoop .http .HttpServer2 .CONF_CONTEXT_ATTRIBUTE ,
680682 conf );
681683 ctx .getServletContext ().setAttribute (ADMINS_ACL , adminsAcl );
682- addNoCacheFilter (ctx );
684+ addNoCacheFilter (ctx , conf );
683685 return ctx ;
684686 }
685687
@@ -701,9 +703,16 @@ public static GzipHandler buildGzipHandler(final Handler wrapped) {
701703 return gzipHandler ;
702704 }
703705
704- private static void addNoCacheFilter (WebAppContext ctxt ) {
705- defineFilter (ctxt , NO_CACHE_FILTER , NoCacheFilter .class .getName (),
706- Collections .<String , String > emptyMap (), new String [] { "/*" });
706+ private static void addNoCacheFilter (ServletContextHandler ctxt , Configuration conf ) {
707+ if (conf .getBoolean (HTTP_UI_NO_CACHE_ENABLE_KEY , false )) {
708+ Map <String , String > filterConfig =
709+ AuthenticationFilterInitializer .getFilterConfigMap (conf , "hbase.http.filter." );
710+ defineFilter (ctxt , NO_CACHE_FILTER , NoCacheFilter .class .getName (), filterConfig ,
711+ new String [] { "/*" });
712+ } else {
713+ defineFilter (ctxt , NO_CACHE_FILTER , NoCacheFilter .class .getName (),
714+ Collections .<String , String > emptyMap (), new String [] { "/*" });
715+ }
707716 }
708717
709718 /** Get an array of FilterConfiguration specified in the conf */
@@ -749,6 +758,7 @@ protected void addDefaultApps(ContextHandlerCollection parent, final String appD
749758 }
750759 logContext .setDisplayName ("logs" );
751760 setContextAttributes (logContext , conf );
761+ addNoCacheFilter (logContext , conf );
752762 defaultContexts .put (logContext , true );
753763 }
754764 // set up the context for "/static/*"
0 commit comments