コード例 #1
0
        private void CheckToken()
        {
            if (_token == null)
            {
                throw new UnauthorizedAccessException("Cannot create Box session with given token");
            }
            if (_token.IsExpired)
            {
                _token = OAuth20TokenHelper.RefreshToken(BoxLoginProvider.BoxOauthTokenUrl, _token);

                using (var dbDao = new CachedProviderAccountDao(CoreContext.TenantManager.GetCurrentTenant().TenantId, FileConstant.DatabaseId))
                {
                    dbDao.UpdateProviderInfo(ID, new AuthData(token: _token.ToJson()));
                }
            }
        }
コード例 #2
0
        private static string EncryptToken(OAuth20Token token)
        {
            var t = token.ToJson();

            return(string.IsNullOrEmpty(t) ? string.Empty : InstanceCrypto.Encrypt(t));
        }