Class: Authorization

Authorization(verb, blob, extraopt)

Generate authorization tokens for the requests to Azure Blob Storage

Constructor

new Authorization(verb, blob, extraopt)

Constructor

Parameters:
Name Type Attributes Description
verb string

HTTP verb used (e.g. GET, PUT...)

blob string

Name of the blob accessed

extra Object <optional>

Optional, extra paramters

Properties
Name Type Description
contentMD5 string

Value for the Content-MD5 header (optional)

contentType string

Value for the Content-Type header (optional)

qs Object

Dictionary of values for the querystring to append to the URL (optional)

Source:

Members

date

Return the request date stored into the object, for use with the "x-ms-date" header

Source:

headers

Getter for the list of headers to add to the request

Source:

Methods

addCustomHeader(name, value)

Add a custom "x-ms-*" header to the request.

Parameters:
Name Type Description
name String

Name of the header (must start with "x-ms-*")

value String

Value of the header

Source:

generateAuthorizationHeader() → {string}

Generate the Authorization header for the request.

When using SAS tokens, this returns null.

Source:
Returns:

Value for the Authorization header

Type
string

generateSignature() → {string}

Generate the signature for the Authorization header.

When using SAS tokens, this returns null.

Source:
Returns:

Signature for the request

Type
string

querystring() → {Object}

Return values for the querystring of URLs when uploading a blob. This is necessary when using SAS tokens.

Source:
Returns:

Querystring values to append to blob URL when uploading

Type
Object

requestHeaders() → {Object}

Return the list of all headers, including Authorization, Content-MD5 and Content-Type, ready for sending the request.

Source:
Returns:

List of all headers

Type
Object

setStorageAccount(name, key, sasToken)

Manually set the storage account name and key

Parameters:
Name Type Description
name string

Name for the storage account

key string

Access key for the storage account

sasToken string

SAS token for the storage account

Source: