Comments (2)
I have already created a quick service like that, and you are free to modify it and add it to the core module. It currently looks like this:
import { Injectable } from '@nestjs/common';
import * as azure from '@azure/storage-blob';
import { ConfigService } from '../config/config.service';
import {
AccountSASServices,
AccountSASResourceTypes,
} from '@azure/storage-blob';
@Injectable()
export class AzureSASService {
private credential: azure.SharedKeyCredential;
constructor(private readonly configService: ConfigService) {
this.credential = new azure.SharedKeyCredential(
this.configService.get('AZURE_STORAGE_ACCOUNT'),
this.configService.get('AZURE_STORAGE_ACCOUNT_KEY')
);
}
getNewSASKey() { //We should probably add a config object here
let expiryTime = new Date();
let startTime = new Date();
expiryTime.setMonth(new Date().getMonth() + 1);
startTime.setFullYear(startTime.getFullYear() - 10);
return (
'?' +
azure
.generateAccountSASQueryParameters(
{
expiryTime,
services: AccountSASServices.parse('b').toString(),
resourceTypes: AccountSASResourceTypes.parse(
'sco'
).toString(),
permissions: azure.ContainerSASPermissions.parse(
'racwdl'
).toString(),
startTime,
ipRange: { start: '0.0.0.0', end: '255.255.255.255' },
protocol: azure.SASProtocol.HTTPSandHTTP,
version: '2018-11-09',
},
this.credential
)
.toString()
);
}
}
from azure-storage.
May I ask if there is any update on this issue.
Granting access to resources using SAS signed url is pretty common use case of Azure Blob Storage. Sometimes we don't want to use our server bandwidth for download and upload actions. The server might only take care of access management.
I could help with drafting the feature and raise a PR if help is wanted.
from azure-storage.
Related Issues (20)
- NestJS 7 support HOT 2
- Semi PR Request (upgrades in azure library) HOT 3
- How can I delete an image from Azure Storage Container? HOT 2
- I can't install this package with npm@7 HOT 4
- Error encountered: 404 HOT 1
- Accessing Azure SDK Method using this module
- Could not resolve dependency HOT 1
- Dependency Dashboard
- Change UploadedFileMetaData interface's size property to number from string type.
- Add command isn't working as expected HOT 3
- Upload: reject promise when Azure errors
- Cannot set properties of undefined (setting 'start:azure')
- Dependency issue HOT 3
- Using AzureStorageModule in different modules overrides one another's config HOT 1
- Update dependencies
- Add forRootAsync for configuration via configService HOT 3
- Add folder creation support HOT 1
- Add custom filename on upload HOT 3
- Validate the SAS key format
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-storage.