test_class.declarator: kdcServer
test_class.modifier: private
test_class.original_string: private SimpleKdcServer kdcServer;
test_class.type: SimpleKdcServer
test_class.var_name: kdcServer
test_class.declarator: serverHost = "localhost"
test_class.modifier: private
test_class.original_string: private String serverHost = "localhost";
test_class.type: String
test_class.var_name: serverHost
test_class.declarator: serverPort = -1
test_class.modifier: private
test_class.original_string: private int serverPort = -1;
test_class.type: int
test_class.var_name: serverPort
test_class.declarator: keytabFileName = "smart.keytab"
test_class.modifier: private final
test_class.original_string: private final String keytabFileName = "smart.keytab";
test_class.type: String
test_class.var_name: keytabFileName
test_class.declarator: principal = "ssmroot@EXAMPLE.COM"
test_class.modifier: private final
test_class.original_string: private final String principal = "ssmroot@EXAMPLE.COM";
test_class.type: String
test_class.var_name: principal
test_class.declarator: ticketCacheFileName = "smart.cc"
test_class.modifier: private final
test_class.original_string: private final String ticketCacheFileName = "smart.cc";
test_class.type: String
test_class.var_name: ticketCacheFileName
test_class.file: smart-common/src/test/java/org/smartdata/utils/TestSecurityUtil.java
test_class.identifier: TestSecurityUtil
test_case.body: @Test
    public void loginUsingKeytab() throws Exception {
      File keytabFile = generateKeytab(keytabFileName, principal);
      Subject subject = SecurityUtil.loginUsingKeytab(principal, keytabFile);
      Assert.assertEquals(principal, subject.getPrincipals().iterator().next().getName());
      System.out.println("Login successful for user: "
          + subject.getPrincipals().iterator().next());
    }
test_case.class_method_signature: TestSecurityUtil.loginUsingKeytab()
test_case.full_signature: @Test public void loginUsingKeytab()
test_case.identifier: loginUsingKeytab
test_case.invocations: generateKeytab loginUsingKeytab assertEquals getName next iterator getPrincipals println next iterator getPrincipals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void loginUsingKeytab()
focal_class.declarator: LOG = LoggerFactory.getLogger(SecurityUtil.class)
focal_class.modifier: public static final
focal_class.original_string: public static final Logger LOG = LoggerFactory.getLogger(SecurityUtil.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: ENABLE_DEBUG = true
focal_class.modifier: public static final
focal_class.original_string: public static final boolean ENABLE_DEBUG = true;
focal_class.type: boolean
focal_class.var_name: ENABLE_DEBUG
focal_class.declarator: BASIC_JAAS_OPTIONS =
        new HashMap<String, String>()
focal_class.modifier: private static final
focal_class.original_string: private static final Map<String, String> BASIC_JAAS_OPTIONS =
        new HashMap<String, String>();
focal_class.type: Map<String, String>
focal_class.var_name: BASIC_JAAS_OPTIONS
focal_class.declarator: TICKET_KERBEROS_OPTIONS =
        new HashMap<String, String>()
focal_class.modifier: private static final
focal_class.original_string: private static final Map<String, String> TICKET_KERBEROS_OPTIONS =
        new HashMap<String, String>();
focal_class.type: Map<String, String>
focal_class.var_name: TICKET_KERBEROS_OPTIONS
focal_class.declarator: TICKET_KERBEROS_LOGIN =
        new AppConfigurationEntry(getKrb5LoginModuleName(),
            AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL,
            TICKET_KERBEROS_OPTIONS)
focal_class.modifier: private static final
focal_class.original_string: private static final AppConfigurationEntry TICKET_KERBEROS_LOGIN =
        new AppConfigurationEntry(getKrb5LoginModuleName(),
            AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL,
            TICKET_KERBEROS_OPTIONS);
focal_class.type: AppConfigurationEntry
focal_class.var_name: TICKET_KERBEROS_LOGIN
focal_class.file: smart-common/src/main/java/org/smartdata/utils/SecurityUtil.java
focal_class.identifier: SecurityUtil
focal_class.class_method_signature: SecurityUtil.getKrb5LoginModuleName()
focal_class.full_signature: private static String getKrb5LoginModuleName()
focal_class.identifier: getKrb5LoginModuleName
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getKrb5LoginModuleName()
focal_class.class_method_signature: SecurityUtil.loginUserFromTgtTicket(String smartSecurity)
focal_class.full_signature: public static synchronized Subject loginUserFromTgtTicket(String smartSecurity)
focal_class.identifier: loginUserFromTgtTicket
focal_class.modifiers: public static synchronized
focal_class.parameters: (String smartSecurity)
focal_class.return: Subject
focal_class.signature: Subject loginUserFromTgtTicket(String smartSecurity)
focal_class.class_method_signature: SecurityUtil.loginUsingTicketCache(String principal)
focal_class.full_signature: public static Subject loginUsingTicketCache(String principal)
focal_class.identifier: loginUsingTicketCache
focal_class.modifiers: public static
focal_class.parameters: (String principal)
focal_class.return: Subject
focal_class.signature: Subject loginUsingTicketCache(String principal)
focal_class.class_method_signature: SecurityUtil.loginUsingTicketCache(
        String principal, String ticketCacheFileName)
focal_class.full_signature: @VisibleForTesting static Subject loginUsingTicketCache(
        String principal, String ticketCacheFileName)
focal_class.identifier: loginUsingTicketCache
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (
        String principal, String ticketCacheFileName)
focal_class.return: Subject
focal_class.signature: Subject loginUsingTicketCache(
        String principal, String ticketCacheFileName)
focal_class.class_method_signature: SecurityUtil.loginUsingKeytab(SmartConf conf)
focal_class.full_signature: public static void loginUsingKeytab(SmartConf conf)
focal_class.identifier: loginUsingKeytab
focal_class.modifiers: public static
focal_class.parameters: (SmartConf conf)
focal_class.return: void
focal_class.signature: void loginUsingKeytab(SmartConf conf)
focal_class.class_method_signature: SecurityUtil.loginUsingKeytab(String keytabFilename, String principal)
focal_class.full_signature: public static void loginUsingKeytab(String keytabFilename, String principal)
focal_class.identifier: loginUsingKeytab
focal_class.modifiers: public static
focal_class.parameters: (String keytabFilename, String principal)
focal_class.return: void
focal_class.signature: void loginUsingKeytab(String keytabFilename, String principal)
focal_class.class_method_signature: SecurityUtil.loginUsingKeytab(
        String principal, File keytabFile)
focal_class.full_signature: public static Subject loginUsingKeytab(
        String principal, File keytabFile)
focal_class.identifier: loginUsingKeytab
focal_class.modifiers: public static
focal_class.parameters: (
        String principal, File keytabFile)
focal_class.return: Subject
focal_class.signature: Subject loginUsingKeytab(
        String principal, File keytabFile)
focal_class.class_method_signature: SecurityUtil.useTicketCache(String principal, String ticketCacheFileName)
focal_class.full_signature: public static Configuration useTicketCache(String principal, String ticketCacheFileName)
focal_class.identifier: useTicketCache
focal_class.modifiers: public static
focal_class.parameters: (String principal, String ticketCacheFileName)
focal_class.return: Configuration
focal_class.signature: Configuration useTicketCache(String principal, String ticketCacheFileName)
focal_class.class_method_signature: SecurityUtil.useKeytab(String principal, File keytabFile)
focal_class.full_signature: public static Configuration useKeytab(String principal, File keytabFile)
focal_class.identifier: useKeytab
focal_class.modifiers: public static
focal_class.parameters: (String principal, File keytabFile)
focal_class.return: Configuration
focal_class.signature: Configuration useKeytab(String principal, File keytabFile)
focal_class.class_method_signature: SecurityUtil.isSecurityEnabled(SmartConf conf)
focal_class.full_signature: public static boolean isSecurityEnabled(SmartConf conf)
focal_class.identifier: isSecurityEnabled
focal_class.modifiers: public static
focal_class.parameters: (SmartConf conf)
focal_class.return: boolean
focal_class.signature: boolean isSecurityEnabled(SmartConf conf)
focal_method.body: public static void loginUsingKeytab(SmartConf conf) throws IOException{
      String keytabFilename = conf.get(SmartConfKeys.SMART_SERVER_KEYTAB_FILE_KEY);
      if (keytabFilename == null || keytabFilename.length() == 0) {
        throw new IOException("Running in secure mode, but config doesn't have a keytab");
      }
      File keytabPath = new File(keytabFilename);
      String principalConfig = conf.get(SmartConfKeys.SMART_SERVER_KERBEROS_PRINCIPAL_KEY);
      String principal =
          org.apache.hadoop.security.SecurityUtil.getServerPrincipal(principalConfig, (String) null);
      try {
        SecurityUtil.loginUsingKeytab(keytabPath.getAbsolutePath(), principal);
      } catch (IOException e) {
        LOG.error("Fail to login using keytab. " + e);
        throw new IOException("Fail to login using keytab. " + e);
      }
      LOG.info("Login successful for user: " + principal);
    }
focal_method.class_method_signature: SecurityUtil.loginUsingKeytab(SmartConf conf)
focal_method.full_signature: public static void loginUsingKeytab(SmartConf conf)
focal_method.identifier: loginUsingKeytab
focal_method.invocations: get length get getServerPrincipal loginUsingKeytab getAbsolutePath error info
focal_method.modifiers: public static
focal_method.parameters: (SmartConf conf)
focal_method.return: void
focal_method.signature: void loginUsingKeytab(SmartConf conf)