зеркало из https://github.com/Azure/AzureCosmosR.git
sign request
This commit is contained in:
Родитель
82f6d2f0f7
Коммит
da78f53895
|
@ -0,0 +1,2 @@
|
|||
# assorted imports of friend functions
|
||||
sign_sha256 <- get("sign_sha256", getNamespace("AzureStor"))
|
|
@ -0,0 +1,26 @@
|
|||
sign_request.table_endpoint <- function(endpoint, verb, url, headers, api, ...)
|
||||
{
|
||||
make_sig <- function(key, verb, acct_name, resource, headers)
|
||||
{
|
||||
names(headers) <- tolower(names(headers))
|
||||
sigstr <- paste(verb,
|
||||
as.character(headers[["content-md5"]]),
|
||||
as.character(headers[["content-type"]]),
|
||||
as.character(headers[["date"]]),
|
||||
resource, sep = "\n")
|
||||
sigstr <- sub("\n$", "", sigstr)
|
||||
paste0("SharedKey ", acct_name, ":", sign_sha256(sigstr, key))
|
||||
}
|
||||
|
||||
acct_name <- sub("\\..+$", "", url$host)
|
||||
resource <- paste0("/", acct_name, "/", url$path)
|
||||
resource <- gsub("//", "/", resource)
|
||||
if (is.null(headers$date) || is.null(headers$Date))
|
||||
headers$date <- httr::http_date(Sys.time())
|
||||
if (is.null(headers$`x-ms-version`))
|
||||
headers$`x-ms-version` <- api
|
||||
|
||||
sig <- make_sig(endpoint$key, verb, acct_name, resource, headers)
|
||||
modifyList(headers, list(Host = url$host, Authorization = sig))
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче