/// <summary>
 /// Check if token expired by time
 /// (tolerance applies)
 /// </summary>
 /// <param name="dateTime">Time for check</param>
 /// <param name="tolerance">tolerance in seconds</param>
 /// <returns>true if expired</returns>
 public bool Expired(DateTime dateTime, long tolerance)
 {
     return(ExpiresAt.CompareTo(dateTime.AddSeconds(-tolerance)) <= 0);
 }
Example #2
0
 public virtual bool HasExpired()
 {
     return(ExpiresAt.CompareTo(DateTime.Now) <= 0);
 }
 /// <summary>
 /// Check if token expired by time
 /// (tolerance applies)
 /// </summary>
 /// <param name="dateTime">Time for check</param>
 /// <returns>true if expired</returns>
 private bool Expired(DateTime dateTime)
 {
     return(ExpiresAt.CompareTo(dateTime) <= 0);
 }