diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77ef0e78..a1a88804 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,8 @@
# Changelog
## [Unreleased]
+### Added
+- `rp.oauth.use.proxy` parameter to control if OAuth HTTP client Inherits proxy settings from general client, by @HardNorth
## [5.4.5]
### Added
diff --git a/README_TEMPLATE.md b/README_TEMPLATE.md
index 9ce441f1..46f67865 100644
--- a/README_TEMPLATE.md
+++ b/README_TEMPLATE.md
@@ -85,41 +85,42 @@ value will be used.
### Common parameters
-| **Property name** | **Type** | **Description** | **Required** |
-|------------------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
-| rp.endpoint | String | URL of web service, where requests should be send | Yes |
-| rp.api.key | String | Api token of user. **Required** if OAuth 2.0 authentication is not used. | Conditional |
-| rp.oauth.token.uri | String | OAuth 2.0 token endpoint URL for password grant authentication. **Required** if API key is not used. | Conditional |
-| rp.oauth.username | String | OAuth 2.0 username for password grant authentication. **Required** if OAuth 2.0 is used. | Conditional |
-| rp.oauth.password | String | OAuth 2.0 password for password grant authentication. **Required** if OAuth 2.0 is used. | Conditional |
-| rp.oauth.client.id | String | OAuth 2.0 client identifier. **Required** if OAuth 2.0 is used. | Conditional |
-| rp.oauth.client.secret | String | OAuth 2.0 client secret. **Optional** for OAuth 2.0 authentication. | No |
-| rp.oauth.scope | String | OAuth 2.0 access token scope. **Optional** for OAuth 2.0 authentication. | No |
-| rp.launch | String | A unique name of Launch (Run). Based on that name a history of runs will be created for particular name | Yes |
-| rp.project | String | Project name to identify scope | Yes |
-| rp.launch.uuid | String | A unique Launch UUID to which the whole test execution will be uploaded. | No |
-| rp.launch.uuid.creation.skip | Boolean | Do not create new launch and report to predefined Launch provided by UUID above. Default `true`. | No |
-| rp.launch.uuid.print | Boolean | Enables printing Launch UUID on test run start. Default `false`. | No |
-| rp.launch.uuid.print.output | Enum | Launch UUID print output. Default `stdout`. Possible values: `stderr`, `stdout`. | No |
-| rp.enable | Boolean | Enable/Disable logging to ReportPortal: rp.enable=true - enable log to RP server. Any other value means 'false': rp.enable=false - disable log to RP server. If parameter is absent in properties file then automation project results will be posted on RP. | No |
-| rp.description | String | Launch description | No |
-| rp.attributes | String | Set of attributes for specifying additional meta information for current launch. Format: key:value;value;build:12345-6. Attributes should be separated by “;”, keys and values - “:”. | No |
-| rp.reporting.async | Boolean | Enables asynchronous reporting. Available values - `true` (by default) or `false`. Supported only in 5+ version. | No |
-| rp.reporting.callback | Boolean | Enables [callback reporting](https://github.com/reportportal/client-java/wiki/Callback-reporting-usefulness). Available values - `true` or `false`(by default). Supported only in 5+ vesion | No |
-| rp.rerun | Boolean | Enables [rerun mode](https://reportportal.io/docs/developers-guides/RerunDevelopersGuide/). Available values - `true` or `false`(by default). Supported only in 5+ version | No |
-| rp.rerun.of | String | Specifies UUID of launch that has to be rerun. | No |
-| rp.convertimage | Boolean | Colored log images can be converted to grayscale for reducing image size. Values: ‘true’ – will be converted. Any other value means ‘false’. | No |
-| rp.mode | Enum | ReportPortal provides possibility to specify visibility of executing launch. Currently two modes are supported: DEFAULT - all users from project can see this launch; DEBUG - all users except of Customer role can see this launch (in debug sub tab). Note: for all java based clients (TestNG, Junit) mode will be set automatically to "DEFAULT" if it is not specified. | No |
-| rp.skipped.issue | Boolean | ReportPortal provides feature to mark skipped tests as not 'To Investigate' items on WS side. Parameter could be equal boolean values:
`true` - skipped tests considered as issues and will be marked as 'To Investigate' on ReportPortal. `false` - skipped tests will not be marked as 'To Investigate' on application. | No |
-| rp.batch.size.logs | Integer | Put logs into batches of specified size in order to rise up performance and reduce number of requests to server. Default = 10 | No |
-| rp.batch.payload.limit | Long | Limit batches by payload size to avoid request rejection due to server limitations. | No |
-| rp.rx.buffer.size | Integer | Internal queue size for log processing, increase this value along with log batch size if you see not all your logs passing to server. Default = 128 | No |
-| rp.keystore.resource | String | Keystore file path to be used in HTTPS communication | No |
-| rp.keystore.password | String | Access password for certificate storage package, mentioned above | No |
-| rp.keystore.type | String | Keystore type. Default: `JKS` | No |
-| rp.truststore.resource | String | Truststore file path to be used in HTTPS communication | No |
-| rp.truststore.password | String | Access password for certificate storage package, mentioned above | No |
-| rp.truststore.type | String | Truststore type. Default: `JKS` | No |
+| **Property name** | **Type** | **Description** | **Required** |
+|------------------------------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
+| rp.endpoint | String | URL of web service, where requests should be send | Yes |
+| rp.api.key | String | Api token of user. **Required** if OAuth 2.0 authentication is not used. | Conditional |
+| rp.oauth.token.uri | String | OAuth 2.0 token endpoint URL for password grant authentication. **Required** if API key is not used. | Conditional |
+| rp.oauth.username | String | OAuth 2.0 username for password grant authentication. **Required** if OAuth 2.0 is used. | Conditional |
+| rp.oauth.password | String | OAuth 2.0 password for password grant authentication. **Required** if OAuth 2.0 is used. | Conditional |
+| rp.oauth.client.id | String | OAuth 2.0 client identifier. **Required** if OAuth 2.0 is used. | Conditional |
+| rp.oauth.client.secret | String | OAuth 2.0 client secret. **Optional** for OAuth 2.0 authentication. | No |
+| rp.oauth.scope | String | OAuth 2.0 access token scope. **Optional** for OAuth 2.0 authentication. | No |
+| rp.oauth.use.proxy | Boolean | Default: `true`
Determines if OAuth HTTP client Inherits proxy settings from general client | No |
+| rp.launch | String | A unique name of Launch (Run). Based on that name a history of runs will be created for particular name | Yes |
+| rp.project | String | Project name to identify scope | Yes |
+| rp.launch.uuid | String | A unique Launch UUID to which the whole test execution will be uploaded. | No |
+| rp.launch.uuid.creation.skip | Boolean | Do not create new launch and report to predefined Launch provided by UUID above. Default `true`. | No |
+| rp.launch.uuid.print | Boolean | Enables printing Launch UUID on test run start. Default `false`. | No |
+| rp.launch.uuid.print.output | Enum | Launch UUID print output. Default `stdout`. Possible values: `stderr`, `stdout`. | No |
+| rp.enable | Boolean | Enable/Disable logging to ReportPortal: rp.enable=true - enable log to RP server. Any other value means 'false': rp.enable=false - disable log to RP server. If parameter is absent in properties file then automation project results will be posted on RP. | No |
+| rp.description | String | Launch description | No |
+| rp.attributes | String | Set of attributes for specifying additional meta information for current launch. Format: key:value;value;build:12345-6. Attributes should be separated by “;”, keys and values - “:”. | No |
+| rp.reporting.async | Boolean | Enables asynchronous reporting. Available values - `true` (by default) or `false`. Supported only in 5+ version. | No |
+| rp.reporting.callback | Boolean | Enables [callback reporting](https://github.com/reportportal/client-java/wiki/Callback-reporting-usefulness). Available values - `true` or `false`(by default). Supported only in 5+ vesion | No |
+| rp.rerun | Boolean | Enables [rerun mode](https://reportportal.io/docs/developers-guides/RerunDevelopersGuide/). Available values - `true` or `false`(by default). Supported only in 5+ version | No |
+| rp.rerun.of | String | Specifies UUID of launch that has to be rerun. | No |
+| rp.convertimage | Boolean | Colored log images can be converted to grayscale for reducing image size. Values: ‘true’ – will be converted. Any other value means ‘false’. | No |
+| rp.mode | Enum | ReportPortal provides possibility to specify visibility of executing launch. Currently two modes are supported: DEFAULT - all users from project can see this launch; DEBUG - all users except of Customer role can see this launch (in debug sub tab). Note: for all java based clients (TestNG, Junit) mode will be set automatically to "DEFAULT" if it is not specified. | No |
+| rp.skipped.issue | Boolean | ReportPortal provides feature to mark skipped tests as not 'To Investigate' items on WS side. Parameter could be equal boolean values: `true` - skipped tests considered as issues and will be marked as 'To Investigate' on ReportPortal. `false` - skipped tests will not be marked as 'To Investigate' on application. | No |
+| rp.batch.size.logs | Integer | Put logs into batches of specified size in order to rise up performance and reduce number of requests to server. Default = 10 | No |
+| rp.batch.payload.limit | Long | Limit batches by payload size to avoid request rejection due to server limitations. | No |
+| rp.rx.buffer.size | Integer | Internal queue size for log processing, increase this value along with log batch size if you see not all your logs passing to server. Default = 128 | No |
+| rp.keystore.resource | String | Keystore file path to be used in HTTPS communication | No |
+| rp.keystore.password | String | Access password for certificate storage package, mentioned above | No |
+| rp.keystore.type | String | Keystore type. Default: `JKS` | No |
+| rp.truststore.resource | String | Truststore file path to be used in HTTPS communication | No |
+| rp.truststore.password | String | Access password for certificate storage package, mentioned above | No |
+| rp.truststore.type | String | Truststore type. Default: `JKS` | No |
Launch name sets once before first execution, because in common launch parts are fixed for a long time. By keeping the
diff --git a/src/main/java/com/epam/reportportal/listeners/ListenerParameters.java b/src/main/java/com/epam/reportportal/listeners/ListenerParameters.java
index 63253cb3..848acf43 100644
--- a/src/main/java/com/epam/reportportal/listeners/ListenerParameters.java
+++ b/src/main/java/com/epam/reportportal/listeners/ListenerParameters.java
@@ -52,6 +52,7 @@ public class ListenerParameters implements Cloneable {
private static final boolean DEFAULT_HTTP_LOGGING = false;
private static final int DEFAULT_RX_BUFFER_SIZE = 128;
private static final String DEFAULT_KEYSTORE_TYPE = "JKS";
+ private static final boolean DEFAULT_OAUTH_USE_PROXY = true;
private static final boolean DEFAULT_CLIENT_JOIN = true;
private static final String DEFAULT_CLIENT_JOIN_MODE = "FILE";
@@ -89,6 +90,7 @@ public class ListenerParameters implements Cloneable {
private String oauthClientId;
private String oauthClientSecret;
private String oauthScope;
+ private boolean oauthUseProxy;
private String baseUrl;
private String proxyUrl;
private String proxyUser;
@@ -247,6 +249,7 @@ public ListenerParameters(PropertiesLoader properties) {
this.oauthClientId = ofNullable(properties.getProperty(OAUTH_CLIENT_ID)).map(String::trim).orElse(null);
this.oauthClientSecret = ofNullable(properties.getProperty(OAUTH_CLIENT_SECRET)).map(String::trim).orElse(null);
this.oauthScope = ofNullable(properties.getProperty(OAUTH_SCOPE)).map(String::trim).orElse(null);
+ this.oauthUseProxy = properties.getPropertyAsBoolean(OAUTH_USE_PROXY, DEFAULT_OAUTH_USE_PROXY);
this.baseUrl = ofNullable(properties.getProperty(BASE_URL)).map(String::trim).orElse(null);
this.proxyUrl = properties.getProperty(HTTP_PROXY_URL);
this.proxyUser = properties.getProperty(HTTP_PROXY_USER);
@@ -395,6 +398,14 @@ public String getOauthScope() {
return oauthScope;
}
+ public boolean isOauthUseProxy() {
+ return oauthUseProxy;
+ }
+
+ public void setOauthUseProxy(boolean oauthUseProxy) {
+ this.oauthUseProxy = oauthUseProxy;
+ }
+
public void setOauthScope(@Nullable String oauthScope) {
this.oauthScope = oauthScope;
}
diff --git a/src/main/java/com/epam/reportportal/service/OAuth2PasswordGrantAuthInterceptor.java b/src/main/java/com/epam/reportportal/service/OAuth2PasswordGrantAuthInterceptor.java
index f6421728..e15bee72 100644
--- a/src/main/java/com/epam/reportportal/service/OAuth2PasswordGrantAuthInterceptor.java
+++ b/src/main/java/com/epam/reportportal/service/OAuth2PasswordGrantAuthInterceptor.java
@@ -101,7 +101,10 @@ public OAuth2PasswordGrantAuthInterceptor(@Nonnull ListenerParameters parameters
URL tokenUrl = parseTokenUri(parameters);
OkHttpClient.Builder clientBuilder = ClientUtils.setupSsl(new OkHttpClient.Builder(), tokenUrl, parameters);
- ClientUtils.setupProxy(clientBuilder, parameters);
+
+ if (parameters.isOauthUseProxy()) {
+ ClientUtils.setupProxy(clientBuilder, parameters);
+ }
ofNullable(parameters.getHttpConnectTimeout()).ifPresent(d -> clientBuilder.connectTimeout(d.toMillis(), TimeUnit.MILLISECONDS));
ofNullable(parameters.getHttpReadTimeout()).ifPresent(d -> clientBuilder.readTimeout(d.toMillis(), TimeUnit.MILLISECONDS));
diff --git a/src/main/java/com/epam/reportportal/utils/properties/ListenerProperty.java b/src/main/java/com/epam/reportportal/utils/properties/ListenerProperty.java
index 1b6e4153..3491bba9 100644
--- a/src/main/java/com/epam/reportportal/utils/properties/ListenerProperty.java
+++ b/src/main/java/com/epam/reportportal/utils/properties/ListenerProperty.java
@@ -75,7 +75,7 @@ public enum ListenerProperty {
LAUNCH_UUID_PRINT_OUTPUT("rp.launch.uuid.print.output", false),
UUID("rp.uuid", false),
API_KEY("rp.api.key", false),
-
+
/**
* OAuth 2.0 authentication properties
*/
@@ -85,6 +85,7 @@ public enum ListenerProperty {
OAUTH_CLIENT_ID("rp.oauth.client.id", false),
OAUTH_CLIENT_SECRET("rp.oauth.client.secret", false),
OAUTH_SCOPE("rp.oauth.scope", false),
+ OAUTH_USE_PROXY("rp.oauth.use.proxy", false),
BATCH_SIZE_LOGS("rp.batch.size.logs", false),
BATCH_PAYLOAD_LIMIT("rp.batch.payload.limit", false),
diff --git a/src/test/java/com/epam/reportportal/listeners/ListenerParametersTest.java b/src/test/java/com/epam/reportportal/listeners/ListenerParametersTest.java
index 2c4cdb3c..b41c8f36 100644
--- a/src/test/java/com/epam/reportportal/listeners/ListenerParametersTest.java
+++ b/src/test/java/com/epam/reportportal/listeners/ListenerParametersTest.java
@@ -230,6 +230,7 @@ public void test_oauth_with_all_parameters() {
assertEquals("test-client-id", listenerParameters.getOauthClientId());
assertEquals("test-client-secret", listenerParameters.getOauthClientSecret());
assertEquals("oauth-scope", listenerParameters.getOauthScope());
+ assertFalse(listenerParameters.isOauthUseProxy());
}
@Test
@@ -243,5 +244,6 @@ public void test_oauth_without_secret() {
assertEquals("test-client-id", listenerParameters.getOauthClientId());
assertNull(listenerParameters.getOauthClientSecret());
assertNull(listenerParameters.getOauthScope());
+ assertTrue(listenerParameters.isOauthUseProxy());
}
}
diff --git a/src/test/resources/property-test/reportportal-oauth.properties b/src/test/resources/property-test/reportportal-oauth.properties
index 231f330e..2d7ec577 100644
--- a/src/test/resources/property-test/reportportal-oauth.properties
+++ b/src/test/resources/property-test/reportportal-oauth.properties
@@ -5,5 +5,6 @@ rp.oauth.password=test-password
rp.oauth.client.id=test-client-id
rp.oauth.client.secret=test-client-secret
rp.oauth.scope=oauth-scope
+rp.oauth.use.proxy=false
rp.project=test-project
rp.launch=test-launch