Skip to content

Commit 7a0a9fc

Browse files
author
sgonzalezMSFT
committed
PR feedback
1 parent 91bfb39 commit 7a0a9fc

File tree

3 files changed

+31
-29
lines changed

3 files changed

+31
-29
lines changed

src/main/java/com/microsoft/aad/msal4j/ClientApplicationBase.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,11 @@ public T executorService(ExecutorService val) {
346346
}
347347

348348
/**
349-
* Sets Proxy configuration to be used by the client application for all network communication.
350-
* Default is null and system defined properties if any, would be used. If HTTP client is set on
351-
* the client application, proxy configuration should be configured on the HTTP client object,
349+
* Sets Proxy configuration to be used by the client application (MSAL4J by default uses
350+
* {@link javax.net.ssl.HttpsURLConnection}) for all network communication.
351+
* If no proxy value is passed in, system defined properties are used. If HTTP client is set on
352+
* the client application (via ClientApplication.builder().httpClient()),
353+
* proxy configuration should be done on the HTTP client object being passed in,
352354
* and not through this method.
353355
*
354356
* @param val an instance of Proxy
@@ -377,8 +379,8 @@ public T httpClient(IHttpClient val){
377379

378380
/**
379381
* Sets SSLSocketFactory to be used by the client application for all network communication.
380-
* If HTTP client is set on the client application, any configuration of SSL should be done on the
381-
* HTTP client and not through this method.
382+
* If HTTP client is set on the client application (via ClientApplication.builder().httpClient()),
383+
* any configuration of SSL should be done on the HTTP client and not through this method.
382384
*
383385
* @param val an instance of SSLSocketFactory
384386
* @return instance of the Builder on which method was called

src/main/java/com/microsoft/aad/msal4j/HttpHeaders.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010

1111
final class HttpHeaders {
1212

13-
private final static String PRODUCT_HEADER_NAME = "x-client-SKU";
14-
private final static String PRODUCT_HEADER_VALUE = "MSAL.Java";
13+
final static String PRODUCT_HEADER_NAME = "x-client-SKU";
14+
final static String PRODUCT_HEADER_VALUE = "MSAL.Java";
1515

16-
private final static String PRODUCT_VERSION_HEADER_NAME = "x-client-VER";
17-
private final static String PRODUCT_VERSION_HEADER_VALUE = getProductVersion();
16+
final static String PRODUCT_VERSION_HEADER_NAME = "x-client-VER";
17+
final static String PRODUCT_VERSION_HEADER_VALUE = getProductVersion();
1818

19-
private final static String CPU_HEADER_NAME = "x-client-CPU";
20-
private final static String CPU_HEADER_VALUE = System.getProperty("os.arch");
19+
final static String CPU_HEADER_NAME = "x-client-CPU";
20+
final static String CPU_HEADER_VALUE = System.getProperty("os.arch");
2121

22-
private final static String OS_HEADER_NAME = "x-client-OS";
23-
private final static String OS_HEADER_VALUE = System.getProperty("os.name");
22+
final static String OS_HEADER_NAME = "x-client-OS";
23+
final static String OS_HEADER_VALUE = System.getProperty("os.name");
2424

25-
private final static String APPLICATION_NAME_HEADER_NAME = "x-app-name";
25+
final static String APPLICATION_NAME_HEADER_NAME = "x-app-name";
2626
private final String applicationNameHeaderValue;
2727

28-
private final static String APPLICATION_VERSION_HEADER_NAME = "x-app-ver";
28+
final static String APPLICATION_VERSION_HEADER_NAME = "x-app-ver";
2929
private final String applicationVersionHeaderValue;
3030

3131
final static String CORRELATION_ID_HEADER_NAME = "client-request-id";

src/test/java/com/microsoft/aad/msal4j/HttpHeaderTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public void testHttpHeaderConstructor(){
2727

2828
Map<String, String> httpHeaderMap = httpHeaders.getReadonlyHeaderMap();
2929

30-
Assert.assertEquals(httpHeaderMap.get("x-client-SKU"), "MSAL.Java");
31-
Assert.assertEquals(httpHeaderMap.get("x-client-VER"), "1.0");
32-
Assert.assertEquals(httpHeaderMap.get("x-client-CPU"), System.getProperty("os.arch"));
33-
Assert.assertEquals(httpHeaderMap.get("x-client-OS"), System.getProperty("os.name"));
34-
Assert.assertEquals(httpHeaderMap.get("x-app-name"), "app-name");
35-
Assert.assertEquals(httpHeaderMap.get("x-app-ver"), "app-version");
36-
Assert.assertEquals(httpHeaderMap.get("client-request-id"), "correlation-id");
30+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.PRODUCT_HEADER_NAME), HttpHeaders.PRODUCT_HEADER_VALUE);
31+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.PRODUCT_VERSION_HEADER_NAME), HttpHeaders.PRODUCT_VERSION_HEADER_VALUE);
32+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.OS_HEADER_NAME), HttpHeaders.OS_HEADER_VALUE);
33+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.CPU_HEADER_NAME), HttpHeaders.CPU_HEADER_VALUE);
34+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.APPLICATION_NAME_HEADER_NAME), "app-name");
35+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.APPLICATION_VERSION_HEADER_NAME), "app-version");
36+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.CORRELATION_ID_HEADER_NAME), "correlation-id");
3737
}
3838

3939
@Test
@@ -49,12 +49,12 @@ public void testHttpHeaderConstructor_valuesNotSet(){
4949

5050
Map<String, String> httpHeaderMap = httpHeaders.getReadonlyHeaderMap();
5151

52-
Assert.assertEquals(httpHeaderMap.get("x-client-SKU"), "MSAL.Java");
53-
Assert.assertEquals(httpHeaderMap.get("x-client-VER"), "1.0");
54-
Assert.assertEquals(httpHeaderMap.get("x-client-CPU"), System.getProperty("os.arch"));
55-
Assert.assertEquals(httpHeaderMap.get("x-client-OS"), System.getProperty("os.name"));
56-
Assert.assertNull(httpHeaderMap.get("x-app-name"));
57-
Assert.assertNull(httpHeaderMap.get("x-app-ver"));
58-
Assert.assertNotNull(httpHeaderMap.get("client-request-id"));
52+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.PRODUCT_HEADER_NAME), HttpHeaders.PRODUCT_HEADER_VALUE);
53+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.PRODUCT_VERSION_HEADER_NAME), HttpHeaders.PRODUCT_VERSION_HEADER_VALUE);
54+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.OS_HEADER_NAME), HttpHeaders.OS_HEADER_VALUE);
55+
Assert.assertEquals(httpHeaderMap.get(HttpHeaders.CPU_HEADER_NAME), HttpHeaders.CPU_HEADER_VALUE);
56+
Assert.assertNull(httpHeaderMap.get(HttpHeaders.APPLICATION_NAME_HEADER_NAME));
57+
Assert.assertNull(httpHeaderMap.get(HttpHeaders.APPLICATION_VERSION_HEADER_NAME));
58+
Assert.assertNotNull(httpHeaderMap.get(HttpHeaders.CORRELATION_ID_HEADER_NAME));
5959
}
6060
}

0 commit comments

Comments
 (0)