| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 | using System;using System.Collections.Generic;using Newtonsoft.Json;namespace Dfs.WayneChina.CardTrxManager.TrxSubmitter{    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; }        [JsonProperty("userName")]        public string UserName { get; set; }        [JsonProperty("alias")]        public string UserAlias { get; set; }        [JsonProperty("roleNames")]        public string RoleNames { get; set; }        [JsonProperty("BusinessUnits")]        public string BusinessUnitsJsonString { get; set; }        public IList<BusinessUnit> BusinessUnitList { 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    }}
 |