Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Commit

Permalink
implementation #60
Browse files Browse the repository at this point in the history
  • Loading branch information
arafato committed Nov 29, 2017
1 parent 26a2d19 commit 3a71161
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/actions/blob/GetContainerAcl.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GetContainerAcl {
response.addHttpProperty(N.BLOB_PUBLIC_ACCESS, response.proxy.original.access);
}
res.set(response.httpProps);
let xml = js2xmlparser.parse('SignedIdentifiers', response.payload);
let xml = js2xmlparser.parse('SignedIdentifiers', response.proxy.original.signedIdentifiers || {});
xml = xml.replace(`<?xml version='1.0'?>`, `<?xml version="1.0" encoding="utf-8"?>`);
res.status(200).send(xml);
});
Expand Down
34 changes: 34 additions & 0 deletions lib/core/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,40 @@ const CopyStatus = {
ABORTED: 'aborted'
}

// See allowed operations below in comments
const ServiceSAS = {
Container: {
// Read the content, properties, metadata or block list of any blob in the container. Use any blob in the container as the source of a copy operation.
READ: 'r',
// Add a block to any append blob in the container.
ADD: 'a',
// Write a new blob to the container, snapshot any blob in the container, or copy a blob to a new blob in the container.
CREATE: 'c',
// For any blob in the container, create or write content, properties, metadata, or block list. Snapshot or lease the blob.
// Resize the blob (page blob only). Use the blob as the destination of a copy operation. Note: You cannot grant permissions
// to read or write container properties or metadata, nor to lease a container, with a service SAS. Use an account SAS instead.
WRITE: 'w',
// Delete any blob in the container. Note: You cannot grant permissions to delete a container with a service SAS. Use an account SAS instead.
DELETE: 'd',
// List blobs in the container.
LIST: 'l'
},
Blob: {
// Read the content, properties, metadata and block list. Use the blob as the source of a copy operation.
READ: 'r',
// Add a block to an append blob.
ADD: 'a',
// Write a new blob, snapshot a blob, or copy a blob to a new blob.
CREATE: 'c',
// Create or write content, properties, metadata, or block list. Snapshot or lease the blob. Resize the blob (page blob only).
// Use the blob as the destination of a copy operation.
WRITE: 'w',
// Delete the blob.
DELETE: 'd'
}

}

module.exports = {
StorageTables: StorageTables,
StorageEntityType: StorageEntityType,
Expand Down
2 changes: 1 addition & 1 deletion lib/middleware/blob/Authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const BbPromise = require('bluebird'),

const _blobService = azure.createBlobService("UseDevelopmentStorage=true;");

module.exports = (req, res) => {
module.exports = (req, res, next) => {
BbPromise.try(() => {
const request = req.azuriteRequest;
if (request.query.sig) {
Expand Down
29 changes: 29 additions & 0 deletions lib/validation/blob/ServiceSignature.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

const AError = require('./../../core/AzuriteError'),
ErrorCodes = require('./../../core/ErrorCodes');

/**
* Checks whether the operation is authorized by the service signature (if existing).
*
* @class ServiceSignature
*/
class ServiceSignature {
constructor() {
}

validate({ request = undefined, moduleOptions = undefined }) {
const sm = moduleOptions.storageManager,
accessPolicy = moduleOptions.accessPolicy;

if (request.auth === undefined) {
return;
}




}
}

module.exports = new ServiceSignature();

0 comments on commit 3a71161

Please sign in to comment.