Lines 96-101
public class AuthManager extends ConfigTestElement implements TestStateListener,
Link Here
|
96 |
|
96 |
|
97 |
private static final boolean DEFAULT_CLEAR_VALUE = false; |
97 |
private static final boolean DEFAULT_CLEAR_VALUE = false; |
98 |
|
98 |
|
|
|
99 |
/** Decides whether port should be omitted from SPN for kerberos spnego authentication */ |
100 |
private static final boolean STRIP_PORT = JMeterUtils.getPropDefault("spnego.strip_port", true); |
101 |
|
99 |
public enum Mechanism { |
102 |
public enum Mechanism { |
100 |
BASIC_DIGEST, KERBEROS; |
103 |
BASIC_DIGEST, KERBEROS; |
101 |
} |
104 |
} |
Lines 392-399
public class AuthManager extends ConfigTestElement implements TestStateListener,
Link Here
|
392 |
log.debug(username + " > D="+domain+" R="+realm + " M="+auth.getMechanism()); |
395 |
log.debug(username + " > D="+domain+" R="+realm + " M="+auth.getMechanism()); |
393 |
} |
396 |
} |
394 |
if (Mechanism.KERBEROS.equals(auth.getMechanism())) { |
397 |
if (Mechanism.KERBEROS.equals(auth.getMechanism())) { |
395 |
boolean stripPort = (url.getPort() == HTTPConstants.DEFAULT_HTTP_PORT || url.getPort() == HTTPConstants.DEFAULT_HTTPS_PORT); |
398 |
((AbstractHttpClient) client).getAuthSchemes().register(AuthPolicy.SPNEGO, new SPNegoSchemeFactory(isStripPort(url))); |
396 |
((AbstractHttpClient) client).getAuthSchemes().register(AuthPolicy.SPNEGO, new SPNegoSchemeFactory(stripPort)); |
|
|
397 |
credentialsProvider.setCredentials(new AuthScope(null, -1, null), USE_JAAS_CREDENTIALS); |
399 |
credentialsProvider.setCredentials(new AuthScope(null, -1, null), USE_JAAS_CREDENTIALS); |
398 |
} else { |
400 |
} else { |
399 |
credentialsProvider.setCredentials( |
401 |
credentialsProvider.setCredentials( |
Lines 403-408
public class AuthManager extends ConfigTestElement implements TestStateListener,
Link Here
|
403 |
} |
405 |
} |
404 |
} |
406 |
} |
405 |
|
407 |
|
|
|
408 |
/** |
409 |
* IE and Firefox will always strip port from the url before constructing |
410 |
* the SPN. Chrome has an option (<code>--enable-auth-negotiate-port</code>) |
411 |
* to include the port if it differs from <code>80</code> or |
412 |
* <code>443</code>. That behavior can be changed by setting the jmeter |
413 |
* property <code>spnego.stripPort</code>. |
414 |
* |
415 |
* @param url |
416 |
* to be checked |
417 |
* @return <code>true</code> when port should omitted in SPN |
418 |
*/ |
419 |
private boolean isStripPort(URL url) { |
420 |
if (STRIP_PORT) |
421 |
return true; |
422 |
return url.getPort() == HTTPConstants.DEFAULT_HTTP_PORT |
423 |
|| url.getPort() == HTTPConstants.DEFAULT_HTTPS_PORT; |
424 |
} |
425 |
|
406 |
/** {@inheritDoc} */ |
426 |
/** {@inheritDoc} */ |
407 |
@Override |
427 |
@Override |
408 |
public void testStarted() { |
428 |
public void testStarted() { |