Skip to content

Commit 75abea0

Browse files
committed
Resolve merge conflicts
1 parent ccb50b1 commit 75abea0

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/JsonHelper.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import com.azure.json.JsonToken;
1010
import com.azure.json.JsonWriter;
1111
import com.azure.json.ReadValueCallback;
12+
import org.slf4j.Logger;
13+
import org.slf4j.LoggerFactory;
1214

1315
import java.io.ByteArrayOutputStream;
1416
import java.io.IOException;
@@ -17,19 +19,11 @@
1719
import java.util.*;
1820

1921
class JsonHelper {
22+
private static final Logger LOG = LoggerFactory.getLogger(JsonHelper.class);
2023

2124
private JsonHelper() {
2225
}
2326

24-
static <T> T convertJsonToObject(final String json, final Class<T> tClass) {
25-
try {
26-
return mapper.readValue(json, tClass);
27-
} catch (Exception e) {
28-
LOG.error(String.format("Error converting JSON string into %s: %s", tClass, e.getMessage()));
29-
throw new MsalJsonParsingException(e.getMessage(), AuthenticationErrorCode.INVALID_JSON);
30-
}
31-
}
32-
3327
static IdToken createIdTokenFromEncodedTokenString(String token) {
3428
return convertJsonStringToJsonSerializableObject(getTokenPayloadClaims(token), IdToken::fromJson);
3529
}

msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/ManagedIdentityTests.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,6 @@ void managedIdentityTest_WithClaims(ManagedIdentitySourceType source, String end
638638
// Clear caching to avoid cross test pollution.
639639
miApp.tokenCache().accessTokens.clear();
640640

641-
String claimsJson = "{\"default\":\"claim\"}";
642-
643641
// First call, get the token from the identity provider.
644642
IAuthenticationResult result = miApp.acquireTokenForManagedIdentity(
645643
ManagedIdentityParameters.builder(resource)
@@ -659,7 +657,7 @@ void managedIdentityTest_WithClaims(ManagedIdentitySourceType source, String end
659657
// Third call, when claims are passed bypass the cache.
660658
result = miApp.acquireTokenForManagedIdentity(
661659
ManagedIdentityParameters.builder(resource)
662-
.claims(claimsJson)
660+
.claims(TestConfiguration.CLAIMS_REQUEST)
663661
.build()).get();
664662

665663
assertNotNull(result.accessToken());
@@ -689,7 +687,6 @@ void managedIdentity_ClaimsAndCapabilities(ManagedIdentitySourceType source, Str
689687
// Clear caching to avoid cross test pollution.
690688
miApp.tokenCache().accessTokens.clear();
691689

692-
String claimsJson = "{\"default\":\"claim\"}";
693690
// First call, get the token from the identity provider.
694691
IAuthenticationResult result = miApp.acquireTokenForManagedIdentity(
695692
ManagedIdentityParameters.builder(resource)
@@ -709,7 +706,7 @@ void managedIdentity_ClaimsAndCapabilities(ManagedIdentitySourceType source, Str
709706
// Third call, when claims are passed bypass the cache.
710707
result = miApp.acquireTokenForManagedIdentity(
711708
ManagedIdentityParameters.builder(resource)
712-
.claims(claimsJson)
709+
.claims(TestConfiguration.CLAIMS_REQUEST)
713710
.build()).get();
714711

715712
assertNotNull(result.accessToken());

0 commit comments

Comments
 (0)