JspHelper { public static String getDelegationTokenUrlParam(String tokenString) { if (tokenString == null ) { return ""; } if (UserGroupInformation.isSecurityEnabled()) { return SET_DELEGATION + tokenString; } else { return ""; } } JspHelper(); DatanodeID randomNode(); DatanodeInfo bestNode(LocatedBlock blk); void streamBlockInAscii(InetSocketAddress addr, long blockId, 
               Token<BlockTokenIdentifier> accessToken, long genStamp, 
                                 long blockSize, 
                                 long offsetIntoBlock, long chunkSizeToView, 
                                 JspWriter out,
                                 Configuration conf); void DFSNodesStatus(ArrayList<DatanodeDescriptor> live,
                             ArrayList<DatanodeDescriptor> dead); void addTableHeader(JspWriter out); void addTableHeadingRow(JspWriter out, String[] columns); void addTableRow(JspWriter out, String[] columns); void addTableFooter(JspWriter out); String getSafeModeText(); static String getWarningText(FSNamesystem fsn); String getInodeLimitText(); String getUpgradeStatusText(); void sortNodeList(ArrayList<DatanodeDescriptor> nodes,
                           String field, String order); static void printPathWithLinks(String dir, JspWriter out, 
                                        int namenodeInfoPort,
                                        String tokenString
                                       ); static void printGotoForm(JspWriter out,
                                   int namenodeInfoPort,
                                   String tokenString,
                                   String file); static void createTitle(JspWriter out, 
                                 HttpServletRequest req, 
                                 String  file); static UserGroupInformation getDefaultWebUser(Configuration conf
                                                       ); static UserGroupInformation getUGI(HttpServletRequest request,
                                            Configuration conf
                                           ); static DFSClient getDFSClient(final UserGroupInformation user,
                                       final InetSocketAddress addr,
                                       final Configuration conf
                                       ); static String getDelegationTokenUrlParam(String tokenString); static int string2ChunkSizeToView(String s, int defaultValue); static int getDefaultChunkSize(Configuration conf); static String getVersionTable(); static final String CURRENT_CONF; final static public String WEB_UGI_PROPERTY_NAME; static final String DELEGATION_PARAMETER_NAME; static InetSocketAddress nameNodeAddr; }
@Test public void testDelegationTokenUrlParam() { conf.set(DFSConfigKeys.HADOOP_SECURITY_AUTHENTICATION, "kerberos"); UserGroupInformation.setConfiguration(conf); String tokenString = "xyzabc"; String delegationTokenParam = JspHelper .getDelegationTokenUrlParam(tokenString); Assert.assertEquals(JspHelper.SET_DELEGATION + "xyzabc", delegationTokenParam); conf.set(DFSConfigKeys.HADOOP_SECURITY_AUTHENTICATION, "simple"); UserGroupInformation.setConfiguration(conf); delegationTokenParam = JspHelper .getDelegationTokenUrlParam(tokenString); Assert.assertEquals("", delegationTokenParam); }