public static async Task <AzureTableStoreTokenCache> GetTokenCacheAsync(ITokenCacheConfig tokenCacheConfig, string userId) { CloudTable tokenCacheTable = await GetTokenCacheTableAsync(tokenCacheConfig); AzureTableStoreTokenCache tokenCache = new AzureTableStoreTokenCache(userId, tokenCacheTable); return(tokenCache); }
private static async Task <CloudTable> GetTokenCacheTableAsync(ITokenCacheConfig tokenCacheConfig) { CloudStorageAccount storageAccount = CloudStorageAccount.Parse(tokenCacheConfig.ConnectionString); CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); CloudTable tokenCacheTable = tableClient.GetTableReference(UserTokenTableName); await tokenCacheTable.CreateIfNotExistsAsync(); return(tokenCacheTable); }
public static AzureTableStoreTokenCache GetTokenCache(ITokenCacheConfig tokenCacheConfig, string userId) { Task <CloudTable> tokenCacheTableTask = GetTokenCacheTableAsync(tokenCacheConfig); if (!tokenCacheTableTask.IsCompleted) { tokenCacheTableTask.Wait(); } AzureTableStoreTokenCache tokenCache = new AzureTableStoreTokenCache(userId, tokenCacheTableTask.Result); return(tokenCache); }