mr/src/itest/java/org/elasticsearch/hadoop/rest/commonshttp/auth/spnego/AbstractSpnegoAuthSchemeTest.java [135:159]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Configuration configuration = new Configuration();
        SecurityUtil.setAuthenticationMethod(UserGroupInformation.AuthenticationMethod.KERBEROS, configuration);
        UserGroupInformation.setConfiguration(configuration);

        // Login as Client and Execute Test
        UserGroupInformation client = UserGroupInformation.loginUserFromKeytabAndReturnUGI(KerberosSuite.PRINCIPAL_CLIENT, KEYTAB_FILE.getAbsolutePath());

        client.doAs(new PrivilegedExceptionAction<Void>() {
            @Override
            public Void run() throws Exception {
                HttpParams params = new HttpClientParams();

                // Order auth schemes
                EsHadoopAuthPolicies.registerAuthSchemes();
                List<String> authPreferences = new ArrayList<String>();
                authPreferences.add(EsHadoopAuthPolicies.NEGOTIATE);
                params.setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPreferences);

                AuthChallengeProcessor authChallengeProcessor = new AuthChallengeProcessor(params);

                Map<String, String> dnsMappings = new HashMap<String, String>();
                dnsMappings.put("es.build.elastic.co", "127.0.0.1");

                TestMethod method = new TestMethod();
                method.setHeaders(new Header[]{new Header("WWW-Authenticate", "Negotiate")});
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



mr/src/itest/java/org/elasticsearch/hadoop/rest/commonshttp/auth/spnego/AbstractSpnegoAuthSchemeTest.java [204:228]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Configuration configuration = new Configuration();
        SecurityUtil.setAuthenticationMethod(UserGroupInformation.AuthenticationMethod.KERBEROS, configuration);
        UserGroupInformation.setConfiguration(configuration);

        // Login as Client and Execute Test
        UserGroupInformation client = UserGroupInformation.loginUserFromKeytabAndReturnUGI(KerberosSuite.PRINCIPAL_CLIENT, KEYTAB_FILE.getAbsolutePath());

        client.doAs(new PrivilegedExceptionAction<Void>() {
            @Override
            public Void run() throws Exception {
                HttpParams params = new HttpClientParams();

                // Order auth schemes
                EsHadoopAuthPolicies.registerAuthSchemes();
                List<String> authPreferences = new ArrayList<String>();
                authPreferences.add(EsHadoopAuthPolicies.NEGOTIATE);
                params.setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPreferences);

                AuthChallengeProcessor authChallengeProcessor = new AuthChallengeProcessor(params);

                Map<String, String> dnsMappings = new HashMap<String, String>();
                dnsMappings.put("es.build.elastic.co", "127.0.0.1");

                TestMethod method = new TestMethod();
                method.setHeaders(new Header[]{new Header("WWW-Authenticate", "Negotiate")});
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



