Exemple #1
0
        public async Task StoreAsync(PersistedGrant grant)
        {
            var        entities = grant.ToEntities();
            CloudTable table    = StorageContext.PersistedGrantTable;

            try
            {
                await Task.WhenAll(table.ExecuteAsync(TableOperation.InsertOrReplace(entities.keyGrant)),
                                   table.ExecuteAsync(TableOperation.InsertOrReplace(entities.subjectGrant)),
                                   StorageContext.SaveBlobWithHashedKeyAsync(grant.Key, grant.Data, StorageContext.PersistedGrantBlobContainer)).ConfigureAwait(false);
            }
            catch (AggregateException agg)
            {
                ExceptionHelper.LogStorageExceptions(agg, (tableEx) =>
                {
                    _logger.LogWarning("exception updating {persistedGrantKey} persisted grant in table storage: {error}", grant.Key, tableEx.Message);
                }, (blobEx) =>
                {
                    _logger.LogWarning("exception updating {persistedGrantKey} persisted grant in blob storage: {error}", grant.Key, blobEx.Message);
                });
            }
        }