HADOOP-8883. Anonymous fallback in KerberosAuthenticator is broken. (rkanter via tucu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1398895 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9757f7407a
commit
ec43a33e2c
@ -158,7 +158,7 @@ public void authenticate(URL url, AuthenticatedURL.Token token)
|
|||||||
conn.setRequestMethod(AUTH_HTTP_METHOD);
|
conn.setRequestMethod(AUTH_HTTP_METHOD);
|
||||||
conn.connect();
|
conn.connect();
|
||||||
|
|
||||||
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
if (conn.getRequestProperty(AUTHORIZATION) != null && conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
||||||
LOG.debug("JDK performed authentication on our behalf.");
|
LOG.debug("JDK performed authentication on our behalf.");
|
||||||
// If the JDK already did the SPNEGO back-and-forth for
|
// If the JDK already did the SPNEGO back-and-forth for
|
||||||
// us, just pull out the token.
|
// us, just pull out the token.
|
||||||
|
@ -134,9 +134,11 @@ protected void _testAuthentication(Authenticator authenticator, boolean doPost)
|
|||||||
try {
|
try {
|
||||||
URL url = new URL(getBaseURL());
|
URL url = new URL(getBaseURL());
|
||||||
AuthenticatedURL.Token token = new AuthenticatedURL.Token();
|
AuthenticatedURL.Token token = new AuthenticatedURL.Token();
|
||||||
|
Assert.assertFalse(token.isSet());
|
||||||
TestConnectionConfigurator connConf = new TestConnectionConfigurator();
|
TestConnectionConfigurator connConf = new TestConnectionConfigurator();
|
||||||
AuthenticatedURL aUrl = new AuthenticatedURL(authenticator, connConf);
|
AuthenticatedURL aUrl = new AuthenticatedURL(authenticator, connConf);
|
||||||
HttpURLConnection conn = aUrl.openConnection(url, token);
|
HttpURLConnection conn = aUrl.openConnection(url, token);
|
||||||
|
Assert.assertTrue(token.isSet());
|
||||||
Assert.assertTrue(connConf.invoked);
|
Assert.assertTrue(connConf.invoked);
|
||||||
String tokenStr = token.toString();
|
String tokenStr = token.toString();
|
||||||
if (doPost) {
|
if (doPost) {
|
||||||
|
@ -43,6 +43,14 @@ public void testFallbacktoPseudoAuthenticator() throws Exception {
|
|||||||
_testAuthentication(new KerberosAuthenticator(), false);
|
_testAuthentication(new KerberosAuthenticator(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testFallbacktoPseudoAuthenticatorAnonymous() throws Exception {
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
|
||||||
|
props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "true");
|
||||||
|
setAuthenticationHandlerConfig(props);
|
||||||
|
_testAuthentication(new KerberosAuthenticator(), false);
|
||||||
|
}
|
||||||
|
|
||||||
public void testNotAuthenticated() throws Exception {
|
public void testNotAuthenticated() throws Exception {
|
||||||
setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
|
setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
|
||||||
start();
|
start();
|
||||||
|
@ -359,6 +359,8 @@ Release 2.0.3-alpha - Unreleased
|
|||||||
HADOOP-8901. GZip and Snappy support may not work without unversioned
|
HADOOP-8901. GZip and Snappy support may not work without unversioned
|
||||||
libraries (Colin Patrick McCabe via todd)
|
libraries (Colin Patrick McCabe via todd)
|
||||||
|
|
||||||
|
HADOOP-8883. Anonymous fallback in KerberosAuthenticator is broken. (rkanter via tucu)
|
||||||
|
|
||||||
Release 2.0.2-alpha - 2012-09-07
|
Release 2.0.2-alpha - 2012-09-07
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
Loading…
Reference in New Issue
Block a user