Skip to content

Commit 0b45b19

Browse files
authored
Add WWW-Authenticate as an Allowed Logged Header (Azure#26973)
1 parent 22975a0 commit 0b45b19

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

sdk/core/azure-core/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
### Other Changes
1212

13+
- Added `x-ms-request-id`, `MS-CV`, `WWW-Authenticate` as default logged headers and `api-version` as a default logged
14+
query parameter.
15+
1316
## 1.25.0 (2022-02-04)
1417

1518
### Features Added

sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLogOptions.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.azure.core.util.logging.ClientLogger;
99

1010
import java.util.Arrays;
11+
import java.util.Collections;
1112
import java.util.HashSet;
1213
import java.util.List;
1314
import java.util.Objects;
@@ -32,10 +33,13 @@ public class HttpLogOptions {
3233
private static final String INVALID_APPLICATION_ID_LENGTH = "'applicationId' length cannot be greater than "
3334
+ MAX_APPLICATION_ID_LENGTH;
3435
private static final String INVALID_APPLICATION_ID_SPACE = "'applicationId' cannot contain spaces.";
35-
private static final List<String> DEFAULT_HEADERS_WHITELIST = Arrays.asList(
36+
private static final List<String> DEFAULT_HEADERS_ALLOWLIST = Arrays.asList(
37+
"x-ms-request-id",
3638
"x-ms-client-request-id",
3739
"x-ms-return-client-request-id",
3840
"traceparent",
41+
"MS-CV",
42+
3943
"Accept",
4044
"Cache-Control",
4145
"Connection",
@@ -54,16 +58,21 @@ public class HttpLogOptions {
5458
"Retry-After",
5559
"Server",
5660
"Transfer-Encoding",
57-
"User-Agent"
61+
"User-Agent",
62+
"WWW-Authenticate"
63+
);
64+
65+
private static final List<String> DEFAULT_QUERY_PARAMS_ALLOWLIST = Collections.singletonList(
66+
"api-version"
5867
);
5968

6069
/**
6170
* Creates a new instance that does not log any information about HTTP requests or responses.
6271
*/
6372
public HttpLogOptions() {
6473
logLevel = HttpLogDetailLevel.ENVIRONMENT_HTTP_LOG_DETAIL_LEVEL;
65-
allowedHeaderNames = new HashSet<>(DEFAULT_HEADERS_WHITELIST);
66-
allowedQueryParamNames = new HashSet<>();
74+
allowedHeaderNames = new HashSet<>(DEFAULT_HEADERS_ALLOWLIST);
75+
allowedQueryParamNames = new HashSet<>(DEFAULT_QUERY_PARAMS_ALLOWLIST);
6776
applicationId = null;
6877
}
6978

0 commit comments

Comments
 (0)