Skip to content

Commit a60641b

Browse files
authored
Merge pull request #249 from AzureAD/dev
Pesomka/release.1.6.1 (#248)
2 parents 36c8796 + c1ff728 commit a60641b

File tree

8 files changed

+28
-11
lines changed

8 files changed

+28
-11
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Quick links:
1616
The library supports the following Java environments:
1717
- Java 8 (or higher)
1818

19-
Current version - 1.6.0
19+
Current version - 1.6.1
2020

2121
You can find the changes for each version in the [change log](https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/master/changelog.txt).
2222

@@ -28,13 +28,13 @@ Find [the latest package in the Maven repository](https://mvnrepository.com/arti
2828
<dependency>
2929
<groupId>com.microsoft.azure</groupId>
3030
<artifactId>msal4j</artifactId>
31-
<version>1.6.0</version>
31+
<version>1.6.1</version>
3232
</dependency>
3333
```
3434
### Gradle
3535

3636
```
37-
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.6.0'
37+
compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.6.1'
3838
```
3939

4040
## Usage

changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Version 1.6.1
2+
=============
3+
- Compatibility with json-smart [1.3.1 - 2.3]
4+
15
Version 1.6.0
26
=============
37
- Client capabilities support

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.microsoft.azure</groupId>
55
<artifactId>msal4j</artifactId>
6-
<version>1.6.0</version>
6+
<version>1.6.1</version>
77
<packaging>jar</packaging>
88
<name>msal4j</name>
99
<description>

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ static TokenResponse parseHttpResponse(final HTTPResponse httpResponse) throws P
4242
return parseJsonObject(jsonObject);
4343
}
4444

45+
static Long getLongValue(JSONObject jsonObject, String key) throws ParseException {
46+
Object value = jsonObject.get(key);
47+
48+
if(value instanceof Long){
49+
return JSONObjectUtils.getLong(jsonObject, key);
50+
}
51+
else
52+
{
53+
return Long.parseLong(JSONObjectUtils.getString(jsonObject, key));
54+
}
55+
}
56+
4557
static TokenResponse parseJsonObject(final JSONObject jsonObject)
4658
throws ParseException {
4759

@@ -68,12 +80,12 @@ static TokenResponse parseJsonObject(final JSONObject jsonObject)
6880

6981
long expiresIn = 0;
7082
if (jsonObject.containsKey("expires_in")) {
71-
expiresIn = Long.parseLong(jsonObject.getAsString("expires_in"));
83+
expiresIn = getLongValue(jsonObject, "expires_in");
7284
}
7385

7486
long ext_expires_in = 0;
7587
if (jsonObject.containsKey("ext_expires_in")) {
76-
ext_expires_in = Long.parseLong(jsonObject.getAsString("ext_expires_in"));
88+
ext_expires_in = getLongValue(jsonObject, "ext_expires_in");
7789
}
7890

7991
String foci = null;

src/samples/msal-b2c-web-sample/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.microsoft.azure</groupId>
2525
<artifactId>msal4j</artifactId>
26-
<version>1.6.0</version>
26+
<version>1.6.1</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>com.nimbusds</groupId>

src/samples/msal-obo-sample/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.microsoft.azure</groupId>
2525
<artifactId>msal4j</artifactId>
26-
<version>1.6.0</version>
26+
<version>1.6.1</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>com.nimbusds</groupId>

src/samples/msal-web-sample/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<dependency>
2424
<groupId>com.microsoft.azure</groupId>
2525
<artifactId>msal4j</artifactId>
26-
<version>1.6.0</version>
26+
<version>1.6.1</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>com.nimbusds</groupId>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ private void validateAccessTokenCacheEntity(String folder, String tokenResponse,
197197
String valueExpected = readResource(folder + AT_CACHE_ENTITY);
198198

199199
JSONObject tokenResponseJsonObj = JSONObjectUtils.parse(tokenResponse);
200-
long expireIn = Long.parseLong(tokenResponseJsonObj.getAsString("expires_in"));
201-
long extExpireIn = Long.parseLong(tokenResponseJsonObj.getAsString("ext_expires_in"));
200+
long expireIn = TokenResponse.getLongValue(tokenResponseJsonObj, "expires_in");
201+
202+
long extExpireIn = TokenResponse.getLongValue(tokenResponseJsonObj, "ext_expires_in");
202203

203204
JSONAssert.assertEquals(valueExpected, valueActual,
204205
new DynamicTimestampsComparator(JSONCompareMode.STRICT, expireIn, extExpireIn));

0 commit comments

Comments
 (0)