From 8047af0ef79c91c6c016c02a102bf66f7a6d2543 Mon Sep 17 00:00:00 2001 From: Aidan Laing Date: Tue, 13 Feb 2018 13:25:38 -0800 Subject: [PATCH] Token Expiry Serialization Added GSON serialized names to token expiresAt and refreshExpiresAt --- .../java/ca/bc/gov/mobileauthentication/data/models/Token.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobileauthentication/src/main/java/ca/bc/gov/mobileauthentication/data/models/Token.kt b/mobileauthentication/src/main/java/ca/bc/gov/mobileauthentication/data/models/Token.kt index ed3bb7f..e6e261a 100644 --- a/mobileauthentication/src/main/java/ca/bc/gov/mobileauthentication/data/models/Token.kt +++ b/mobileauthentication/src/main/java/ca/bc/gov/mobileauthentication/data/models/Token.kt @@ -15,8 +15,8 @@ data class Token( @SerializedName("id_token") val idToken: String?, @SerializedName("not-before-policy") val notBeforePolicy: Long?, @SerializedName("session_state") val sessionState: String?, - val expiresAt: Long = System.currentTimeMillis() + (expiresIn ?: 0 * 1000), - val refreshExpiresAt: Long = System.currentTimeMillis() + (refreshExpiresIn ?: 0 * 1000) + @SerializedName("expires_at") val expiresAt: Long = System.currentTimeMillis() + ((expiresIn ?: 0) * 1000), + @SerializedName("refresh_expires_at") val refreshExpiresAt: Long = System.currentTimeMillis() + ((refreshExpiresIn ?: 0) * 1000) ) { fun isExpired(currentTime: Long = System.currentTimeMillis()): Boolean = expiresAt > currentTime