12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Dfs.WayneChina.SpsDataCourier
- {
- public class AuthToken
- {
- #region Standard OAuth token format
-
-
-
- [JsonProperty("access_token")]
- public string AccessToken { get; set; }
-
-
-
- [JsonProperty("token_type")]
- public string TokenType { get; set; }
-
-
-
- [JsonProperty("expires_in")]
- public int ExpiresIn { get; set; }
-
-
-
- [JsonProperty("refresh_token")]
- public string RefreshToken { get; set; }
-
-
-
- [JsonProperty("error")]
- public string Error { get; set; }
- #endregion
- #region Custom extension
-
-
-
- public DateTime TokenRetrievedTime { get; set; }
-
-
-
-
- public bool IsTokenValid()
- {
-
-
- if (DateTime.Now + new TimeSpan(0, 5, 0) < TokenRetrievedTime + new TimeSpan(0, 0, ExpiresIn))
- return true;
- return false;
- }
- #endregion
- }
- }
|