コード例 #1
0
        public Task <Uri> GetReadAndDeleteUriAsync(
            string packageId,
            string packageNormalizedVersion,
            Guid validationId)
        {
            var fileName = BuildFileName(packageId, packageNormalizedVersion, validationId);

            return(_fileStorageService.GetPriviledgedFileUriAsync(
                       CoreConstants.ValidationFolderName,
                       fileName,
                       FileUriPermissions.Read | FileUriPermissions.Delete,
                       DateTimeOffset.UtcNow + AccessDuration));
        }
コード例 #2
0
        public async Task <Uri> GetReadAndDeleteUriAsync(
            string packageId,
            string packageNormalizedVersion,
            Guid validationId,
            string sasDefinition)
        {
            var fileName = BuildFileName(packageId, packageNormalizedVersion, validationId);

            if (string.IsNullOrEmpty(sasDefinition))
            {
                return(await _fileStorageService.GetPriviledgedFileUriAsync(
                           CoreConstants.Folders.ValidationFolderName,
                           fileName,
                           FileUriPermissions.Read | FileUriPermissions.Delete,
                           DateTimeOffset.UtcNow + AccessDuration));
            }

            var fileUri = await _fileStorageService.GetFileUriAsync(CoreConstants.Folders.ValidationFolderName, fileName);

            var sasToken = await _sharedAccessSignatureService.GetFromManagedStorageAccountAsync(sasDefinition);

            return(new Uri(fileUri, sasToken));
        }