You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2018/09/13 20:20:15 UTC
svn commit: r1840863 - in /jmeter/trunk:
src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
xdocs/changes.xml
Author: pmouawad
Date: Thu Sep 13 20:20:15 2018
New Revision: 1840863
URL: http://svn.apache.org/viewvc?rev=1840863&view=rev
Log:
Bug 62716: When Recording, JMeter removes Authorization from generated Header Manager when using Bearer Token
Bugzilla Id: 62716
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
jmeter/trunk/xdocs/changes.xml
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1840863&r1=1840862&r2=1840863&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java Thu Sep 13 20:20:15 2018
@@ -171,6 +171,8 @@ public class ProxyControl extends Generi
private static final String NOTIFY_CHILD_SAMPLER_LISTENERS_FILTERED = "ProxyControlGui.notify_child_sl_filtered"; // $NON-NLS-1$
+ private static final String BEARER_AUTH = "Bearer";
+
private static final String BASIC_AUTH = "Basic"; // $NON-NLS-1$
private static final String DIGEST_AUTH = "Digest"; // $NON-NLS-1$
@@ -698,11 +700,29 @@ public class ProxyControl extends Generi
if (tep.getName().equals(HTTPConstants.HEADER_AUTHORIZATION)) {
//Construct Authorization object from HEADER_AUTHORIZATION
authHeader = (Header) tep.getObjectValue();
- String[] authHeaderContent = authHeader.getValue().split(" ");//$NON-NLS-1$
+ String headerValue = authHeader.getValue().trim();
+ String[] authHeaderContent = headerValue.split(" ");//$NON-NLS-1$
String authType;
String authCredentialsBase64;
if(authHeaderContent.length>=2) {
authType = authHeaderContent[0];
+ // if HEADER_AUTHORIZATION contains "Basic"
+ // then set Mechanism.BASIC_DIGEST, otherwise Mechanism.KERBEROS
+ Mechanism mechanism;
+ switch (authType) {
+ case BEARER_AUTH:
+ // This one will need to be correlated manually by user
+ return null;
+ case DIGEST_AUTH:
+ mechanism = Mechanism.DIGEST;
+ break;
+ case BASIC_AUTH:
+ mechanism = Mechanism.BASIC;
+ break;
+ default:
+ mechanism = Mechanism.KERBEROS;
+ break;
+ }
authCredentialsBase64 = authHeaderContent[1];
authorization=new Authorization();
try {
@@ -711,20 +731,6 @@ public class ProxyControl extends Generi
log.error("Error filling url on authorization, message: {}", e.getMessage(), e);
authorization.setURL("${AUTH_BASE_URL}");//$NON-NLS-1$
}
- // if HEADER_AUTHORIZATION contains "Basic"
- // then set Mechanism.BASIC_DIGEST, otherwise Mechanism.KERBEROS
- Mechanism mechanism;
- switch (authType) {
- case DIGEST_AUTH:
- mechanism = Mechanism.DIGEST;
- break;
- case BASIC_AUTH:
- mechanism = Mechanism.BASIC;
- break;
- default:
- mechanism = Mechanism.KERBEROS;
- break;
- }
authorization.setMechanism(mechanism);
if(BASIC_AUTH.equals(authType)) {
String authCred= new String(Base64.decodeBase64(authCredentialsBase64));
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1840863&r1=1840862&r2=1840863&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Sep 13 20:20:15 2018
@@ -255,6 +255,7 @@ this behaviour, set <code>httpclient.res
<li><bug>60190</bug>Content-Type is added for <code>POST</code> unconditionally. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
<li><bug>62462</bug><pr>387</pr>Make delegation of credentials in SPNEGO possible again.</li>
<li><bug>58807</bug><code>Reset SSL State on Thread Group iteration only (was https.use.cached.ssl.context=false</code> is broken)</li>
+ <li><bug>62716</bug>When Recording, JMeter removes Authorization from generated Header Manager when using Bearer Token</li>
</ul>
<h3>Other Samplers</h3>