/// <summary> /// Should writes the specified token to the underlying storage /// </summary> /// <param name="token">The token to save</param> /// <returns></returns> protected abstract bool SaveTokenToStore(OAuth2Token token);
/// <summary> /// Writes the specified token to the underlying storage /// </summary> /// <param name="token">The token to save</param> /// <returns></returns> public bool SaveToken(OAuth2Token token) { bool toRet = SaveTokenToStore(token); if (toRet) { CacheItemPolicy policy = new CacheItemPolicy(); DateTime absoluteExpiration = DateTime.UtcNow.AddMinutes(OAuth2Config.OAuth2TokenLocalCacheValidityMinutes); policy.AbsoluteExpiration = new DateTimeOffset(absoluteExpiration); cache.Add(token.AccessToken, token, policy); cache.Add(token.ConsumerKey + token.ConsumerSecret, token, policy); } return toRet; }