Skip to content

Commit a3d8ceb

Browse files
committed
Renamed expiresIn to expiresAt
1 parent 0680a4c commit a3d8ceb

8 files changed

Lines changed: 20 additions & 20 deletions

File tree

V4_MIGRATION_GUIDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ v4 of the Auth0 Android SDK includes significant build toolchain updates, update
1515
- [**Breaking Changes**](#breaking-changes)
1616
+ [Classes Removed](#classes-removed)
1717
+ [DPoP Configuration Moved to Builder](#dpop-configuration-moved-to-builder)
18-
+ [SSOCredentials.expiresIn Type Changed to Date](#ssocredentialsexpiresin-type-changed-to-date)
18+
+ [SSOCredentials.expiresIn Renamed to expiresAt](#ssocredentialsexpiresin-renamed-to-expiresat)
1919
- [**Default Values Changed**](#default-values-changed)
2020
+ [Credentials Manager minTTL](#credentials-manager-minttl)
2121
- [**Behavior Changes**](#behavior-changes)
@@ -124,11 +124,11 @@ WebAuthProvider
124124
This change ensures that DPoP configuration is scoped to individual login requests rather than
125125
persisting across the entire application lifecycle.
126126

127-
### `SSOCredentials.expiresIn` Type Changed to `Date`
127+
### `SSOCredentials.expiresIn` Renamed to `expiresAt`
128128

129-
**Change:** The `expiresIn` property in `SSOCredentials` changed from `Int` to `Date`.
129+
**Change:** The `expiresIn` property in `SSOCredentials` has been renamed to `expiresAt` and its type changed from `Int` to `Date`.
130130

131-
In v3, `expiresIn` held the raw number of seconds until the session transfer token expired. In v4, the SDK now automatically converts this value into an absolute `Date` (computed as current time + seconds) during deserialization, consistent with how `Credentials.expiresAt` works.
131+
In v3, `expiresIn` held the raw number of seconds until the session transfer token expired. In v4, the SDK now automatically converts this value into an absolute expiration `Date` (computed as current time + seconds) during deserialization, consistent with how `Credentials.expiresAt` works. The property has been renamed to `expiresAt` to reflect that it now represents an absolute point in time rather than a duration.
132132

133133
**v3:**
134134

@@ -141,10 +141,10 @@ val secondsUntilExpiry: Int = ssoCredentials.expiresIn
141141

142142
```kotlin
143143
val ssoCredentials: SSOCredentials = // ...
144-
val expirationDate: Date = ssoCredentials.expiresIn
144+
val expirationDate: Date = ssoCredentials.expiresAt
145145
```
146146

147-
**Impact:** If your code previously used `expiresIn` as a duration (e.g., to calculate an expiration time), you can now use it directly as the expiration `Date`.
147+
**Impact:** If your code references `ssoCredentials.expiresIn`, rename it to `ssoCredentials.expiresAt`. The value is now an absolute `Date` instead of a duration in seconds.
148148

149149
## Default Values Changed
150150

auth0/src/main/java/com/auth0/android/request/internal/SSOCredentialsDeserializer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ internal open class SSOCredentialsDeserializer : JsonDeserializer<SSOCredentials
6060
idToken: String,
6161
issuedTokenType: String,
6262
tokenType: String,
63-
expiresIn: Date,
63+
expiresAt: Date,
6464
refreshToken: String?
6565
): SSOCredentials {
6666
return SSOCredentials(
67-
sessionTransferToken, idToken, issuedTokenType, tokenType, expiresIn, refreshToken
67+
sessionTransferToken, idToken, issuedTokenType, tokenType, expiresAt, refreshToken
6868
)
6969
}
7070
}

auth0/src/main/java/com/auth0/android/result/SSOCredentials.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public data class SSOCredentials(
5252
*
5353
* @return the expiration Date of this session transfer token
5454
*/
55-
@field:SerializedName("expires_in") public val expiresIn: Date,
55+
@field:SerializedName("expires_in") public val expiresAt: Date,
5656

5757
/**
5858
* Rotated refresh token. Only available when Refresh Token Rotation is enabled.
@@ -68,6 +68,6 @@ public data class SSOCredentials(
6868
) {
6969

7070
override fun toString(): String {
71-
return "SSOCredentials(sessionTransferToken = ****, idToken = ****,issuedTokenType = $issuedTokenType, tokenType = $tokenType, expiresIn = $expiresIn, refreshToken = ****)"
71+
return "SSOCredentials(sessionTransferToken = ****, idToken = ****,issuedTokenType = $issuedTokenType, tokenType = $tokenType, expiresAt = $expiresAt, refreshToken = ****)"
7272
}
7373
}

auth0/src/test/java/com/auth0/android/authentication/storage/CredentialsManagerTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public class CredentialsManagerTest {
334334
MatcherAssert.assertThat(credentials.tokenType, Is.`is`("token-type"))
335335
MatcherAssert.assertThat(credentials.issuedTokenType, Is.`is`("issued-token-type"))
336336
MatcherAssert.assertThat(credentials.refreshToken, Is.`is`("refresh-token"))
337-
MatcherAssert.assertThat(credentials.expiresIn, Is.`is`(ssoExpiresAt))
337+
MatcherAssert.assertThat(credentials.expiresAt, Is.`is`(ssoExpiresAt))
338338
verify(storage).store("com.auth0.refresh_token", credentials.refreshToken)
339339
}
340340

@@ -427,7 +427,7 @@ public class CredentialsManagerTest {
427427
MatcherAssert.assertThat(credentials.tokenType, Is.`is`("token-type"))
428428
MatcherAssert.assertThat(credentials.issuedTokenType, Is.`is`("issued-token-type"))
429429
MatcherAssert.assertThat(credentials.refreshToken, Is.`is`("refresh-token"))
430-
MatcherAssert.assertThat(credentials.expiresIn, Is.`is`(ssoExpiresAt))
430+
MatcherAssert.assertThat(credentials.expiresAt, Is.`is`(ssoExpiresAt))
431431
verify(storage).store("com.auth0.refresh_token", credentials.refreshToken)
432432
}
433433

auth0/src/test/java/com/auth0/android/authentication/storage/SecureCredentialsManagerTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ public class SecureCredentialsManagerTest {
348348
MatcherAssert.assertThat(credentials.tokenType, Is.`is`("token-type"))
349349
MatcherAssert.assertThat(credentials.issuedTokenType, Is.`is`("issued-token-type"))
350350
MatcherAssert.assertThat(credentials.refreshToken, Is.`is`("refresh-token"))
351-
MatcherAssert.assertThat(credentials.expiresIn, Is.`is`(ssoExpiresAt))
351+
MatcherAssert.assertThat(credentials.expiresAt, Is.`is`(ssoExpiresAt))
352352
verify(storage).store(eq("com.auth0.credentials"), stringCaptor.capture())
353353
val encodedJson = stringCaptor.firstValue
354354
MatcherAssert.assertThat(encodedJson, Is.`is`(Matchers.notNullValue()))
@@ -528,7 +528,7 @@ public class SecureCredentialsManagerTest {
528528
MatcherAssert.assertThat(credentials.tokenType, Is.`is`("token-type"))
529529
MatcherAssert.assertThat(credentials.issuedTokenType, Is.`is`("issued-token-type"))
530530
MatcherAssert.assertThat(credentials.refreshToken, Is.`is`("refresh-token"))
531-
MatcherAssert.assertThat(credentials.expiresIn, Is.`is`(ssoExpiresAt))
531+
MatcherAssert.assertThat(credentials.expiresAt, Is.`is`(ssoExpiresAt))
532532
verify(storage).store(eq("com.auth0.credentials"), stringCaptor.capture())
533533
val encodedJson = stringCaptor.firstValue
534534
MatcherAssert.assertThat(encodedJson, Is.`is`(Matchers.notNullValue()))

auth0/src/test/java/com/auth0/android/request/internal/SSOCredentialsDeserializerMock.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ internal class SSOCredentialsDeserializerMock : SSOCredentialsDeserializer() {
1111
idToken: String,
1212
issuedTokenType: String,
1313
tokenType: String,
14-
expiresIn: Date,
14+
expiresAt: Date,
1515
refreshToken: String?
1616
): SSOCredentials {
1717
return SSOCredentialsMock.create(
18-
sessionTransferToken, idToken, issuedTokenType, tokenType, refreshToken, expiresIn
18+
sessionTransferToken, idToken, issuedTokenType, tokenType, refreshToken, expiresAt
1919
)
2020
}
2121

auth0/src/test/java/com/auth0/android/request/internal/SSOCredentialsDeserializerTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public class SSOCredentialsDeserializerTest {
2626
public fun shouldSetExpiresInFromExpiresInSeconds() {
2727
val json = generateSSOCredentialsJSON()
2828
val credentials = gson.getAdapter(SSOCredentials::class.java).fromJson(json)
29-
MatcherAssert.assertThat(credentials.expiresIn, Is.`is`(CoreMatchers.notNullValue()))
30-
val expiresAt = credentials.expiresIn.time.toDouble()
29+
MatcherAssert.assertThat(credentials.expiresAt, Is.`is`(CoreMatchers.notNullValue()))
30+
val expiresAt = credentials.expiresAt.time.toDouble()
3131
val expectedExpiresAt = (CredentialsMock.CURRENT_TIME_MS + 300 * 1000).toDouble()
3232
MatcherAssert.assertThat(expiresAt, Is.`is`(Matchers.closeTo(expectedExpiresAt, 1.0)))
3333
}

auth0/src/test/java/com/auth0/android/result/SSOCredentialsMock.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ public class SSOCredentialsMock {
1212
issuedTokenType: String,
1313
type: String,
1414
refreshToken: String?,
15-
expiresIn: Date
15+
expiresAt: Date
1616
): SSOCredentials {
1717
return SSOCredentials(
18-
accessToken, idToken, issuedTokenType, type, expiresIn, refreshToken
18+
accessToken, idToken, issuedTokenType, type, expiresAt, refreshToken
1919
)
2020
}
2121
}

0 commit comments

Comments
 (0)