Skip to content

Commit

Permalink
Token Expiry Serialization
Browse files Browse the repository at this point in the history
Added GSON serialized names to token expiresAt and refreshExpiresAt
  • Loading branch information
Aidan Laing committed Feb 13, 2018
1 parent 77a525c commit 8047af0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8047af0

Please sign in to comment.