Skip to content

Commit

Permalink
cast once + use defined constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta19 committed Dec 10, 2024
1 parent f98b1ba commit 8c39dcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private SecureSessionAgentConfig getSecureSessionAgentConfigFromMDS() {

String plaintextS2AAddress = "";
String mtlsS2AAddress = "";
Object s2aAddressConfig = responseData.get(S2A_JSON_KEY);
Map<String, Object> s2aAddressConfig = (Map<String, Object>) responseData.get(S2A_JSON_KEY);
if (s2aAddressConfig == null) {
/*
* Return empty addresses in {@link SecureSessionAgentConfig} if endpoint doesn't return anything.
Expand All @@ -200,18 +200,15 @@ private SecureSessionAgentConfig getSecureSessionAgentConfigFromMDS() {
try {
plaintextS2AAddress =
OAuth2Utils.validateString(
(Map<String, Object>) s2aAddressConfig,
S2A_PLAINTEXT_ADDRESS_JSON_KEY,
PARSE_ERROR_S2A);
s2aAddressConfig, S2A_PLAINTEXT_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
} catch (IOException ignore) {
/*
* Do not throw error because of parsing error, just leave the address as empty in {@link SecureSessionAgentConfig}.
*/
}
try {
mtlsS2AAddress =
OAuth2Utils.validateString(
(Map<String, Object>) s2aAddressConfig, S2A_MTLS_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
OAuth2Utils.validateString(s2aAddressConfig, S2A_MTLS_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
} catch (IOException ignore) {
/*
* Do not throw error because of parsing error, just leave the address as empty in {@link SecureSessionAgentConfig}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public LowLevelHttpResponse execute() throws IOException {
GenericJson content = new GenericJson();
content.setFactory(OAuth2Utils.JSON_FACTORY);
if (requestStatusCode == 200) {
content.put("s2a", s2aContentMap);
content.put(SecureSessionAgent.S2A_JSON_KEY, s2aContentMap);
}
String contentText = content.toPrettyString();

Expand Down

0 comments on commit 8c39dcb

Please sign in to comment.