diff --git a/oauth2_http/java/com/google/auth/oauth2/SecureSessionAgent.java b/oauth2_http/java/com/google/auth/oauth2/SecureSessionAgent.java index d776cb1e3..f39936a31 100644 --- a/oauth2_http/java/com/google/auth/oauth2/SecureSessionAgent.java +++ b/oauth2_http/java/com/google/auth/oauth2/SecureSessionAgent.java @@ -190,7 +190,7 @@ private SecureSessionAgentConfig getSecureSessionAgentConfigFromMDS() { String plaintextS2AAddress = ""; String mtlsS2AAddress = ""; - Object s2aAddressConfig = responseData.get(S2A_JSON_KEY); + Map s2aAddressConfig = (Map) responseData.get(S2A_JSON_KEY); if (s2aAddressConfig == null) { /* * Return empty addresses in {@link SecureSessionAgentConfig} if endpoint doesn't return anything. @@ -200,9 +200,7 @@ private SecureSessionAgentConfig getSecureSessionAgentConfigFromMDS() { try { plaintextS2AAddress = OAuth2Utils.validateString( - (Map) 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}. @@ -210,8 +208,7 @@ private SecureSessionAgentConfig getSecureSessionAgentConfigFromMDS() { } try { mtlsS2AAddress = - OAuth2Utils.validateString( - (Map) 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}. diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockMetadataServerTransport.java b/oauth2_http/javatests/com/google/auth/oauth2/MockMetadataServerTransport.java index 0cc99a7ee..de80c1537 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/MockMetadataServerTransport.java +++ b/oauth2_http/javatests/com/google/auth/oauth2/MockMetadataServerTransport.java @@ -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();