- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 REST API 在 Azure 存储中创建容器。我想授予公共(public)权限或容器权限,以将 blob 动态上传到容器中。我在 header 中写入“x-ms-blob-public-access:container”,但是当我包含以下错误时
Result HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. Content-Length: 709 Content-Type: application/xml Server: Microsoft-HTTPAPI/2.0 x-ms-request-id: 832b00af-501e-0032-7c96-f1ba27000000 Date: Tue, 22 May 2018 06:29:51 GMT AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:832b00af-501e-0032-7c96-f1ba27000000 Time:2018-05-22T06:29:51.7678173ZThe MAC signature found in the HTTP request 'bmJk1ntjZX17woKGTm1YjEaIU3N/NSOXt/a8Gq4lCI0=' is not the same as any computed signature. Server used following string to sign: 'PUT 0 x-ms-blob-public-access:container x-ms-date:Tue, 22 May 2018 06:29:51 GMT x-ms-version:2009-09-19 /dsmsstor1/66-62-108-images restype:container'.Error
我想我也必须将“x-ms-blob-public-access:container”放入 sig 字符串中,但我无法正确执行此操作。帮助我形成正确的签名字符串。即 (PUT\n\n\n0\n\n\n\n\n\n\n\n\nx-ms-date:". $date . "\nx-ms-version:".$version. “\n/dsmsstor1/66-62-108-images\nrestype:容器) 我的代码 ----------
<?php
date_default_timezone_set ( 'GMT' );
$date = date ( "D, j M Y H:i:s T" );
$version = "2009-09-19";
$account_key = 'xxxxxxxxx';
$utf8_encode_str = utf8_encode ("PUT\n\n\n0\n\n\n\n\n\n\n\n\nx-ms-date:". $date . "\nx-ms-version:".$version."\n/dsmsstor1/66-62-108-images\nrestype:container" );
$signature_str = base64_encode(hash_hmac('sha256',$utf8_encode_str, base64_decode($account_key), true));
$header = array (
"x-ms-date: " . $date,
"x-ms-version: " . $version,
"Authorization: SharedKey dsmsstor1:" . $signature_str,
"Content-Length: 0",
"x-ms-blob-public-access:container"
);
$url="https://dsmsstor1.blob.core.windows.net/66-62-108-images?restype=container";
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, 'PUT' );
curl_setopt ($ch, CURLOPT_URL, $url );
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt ($ch, CURLOPT_HEADER, True );
$result = curl_exec ( $ch );
echo ('Result<br/>');
print_r($result);
echo ('Error<br/>');
print_r(curl_error($ch));
curl_close($ch);
?>
最佳答案
您的 $utf8_encode_str
中缺少 x-ms-blob-public-access:container
。
请尝试更改以下代码行:
$utf8_encode_str = utf8_encode ("PUT\n\n\n0\n\n\n\n\n\n\n\n\nx-ms-date:". $date . "\nx-ms-version:".$version."\n/dsmsstor1/66-62-108-images\nrestype:container" );
至
$utf8_encode_str = utf8_encode ("PUT\n\n\n0\n\n\n\n\n\n\n\n\nx-ms-blob-public-access:container\nx-ms-date:". $date . "\nx-ms-version:".$version."\n/dsmsstor1/66-62-108-images\nrestype:container" );
关于azure - 向 Azure 容器授予公共(public)权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50461288/
如何授予 VSTS (TFVC) 用户从分支创建新分支的权限?我已经授予他对 ParentBranch 的“管理分支”和“合并”权限。 当他尝试从“ParentBranch”创建一个名为“ChildB
我在我的 oracle 过程中使用 dbms_crypto.encrypt 函数来加密密码。我已连接到 oracle 为: connect sqlplus as sysdba 然后授予权限: gran
如何在不连接到每一台计算机的情况下将我的 android 设备的 adb 访问权限授予我的所有计算机并按允许? 最佳答案 通过 adb 连接到设备时,每台计算机都会将代码写入 android 设备,以
我有一个 package A ,它在另一个 package B 中使用了一些变量和过程在 相同的架构 .现在想搬家package A到 新架构 .我应该授予 new schema 哪些权限用于使用 p
我需要获取数百个 MS Access DB 的元数据,因此我需要自动化元数据收集过程。 我想查询描述的内容 here ,但在查询数据库之前,我需要对 MSysObjects 进行读取 Access 表
我有一个 JApplet,我想授予它读写打印等权限。该小程序仅从本地文件系统加载 我已经阅读了java教程的控制小程序部分,并成功创建了一个策略文件,授予权限并指定代码库 http://docs.or
我正在使用 phpmyadmin 来调整用户的权限。 我删除了用户“root”的所有访问权限。现在我看不到表格了。 我尝试用另一个用户登录,但它不允许我。 此时我有什么选择? 第 1 步。 //Sto
Mysql 服务器允许从本地主机访问匿名用户。我也想将此权限扩展到其他机器...即,使用没有任何密码的匿名用户从机器 B 的 mysql 客户端访问在机器 A 中运行的 mysql_server。 我
为所有想要连接的新用户授予 MySQL 数据库访问权限的命令是什么? 考虑这个陈述: CREATE USER 'java'@'localhost' IDENTIFIED BY 'password';
我在尝试通过 t 为 mysql 用户授予数据库权限时遇到了一个问题。我认为这是因为数据库名称中的特殊字符。 这个正在工作: /usr/bin/mysql -uroot -pXz5eaCqwvsT0p
我可以在 GRANT 语句中使用静态数据库名称授予权限。 GRANT SELECT,INSERT ON database_name.table_name TO 'username'@'localhos
授予 Facebook 应用查看我的赞的权限是否允许该应用的所有其他用户也看到我的赞? 或者同一应用的其他用户能否看到我的点赞取决于我的点赞隐私设置? 例如,假设我只允许好友看到我的赞。这是否意味着该
我在这里敲了几个小时的脑袋。 我正在向数据库添加用户和密码,同时尝试授予权限。 GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TA
我正在尝试在 Flask 中创建一个自定义错误页面,我想让错误处理程序访问生成导致错误的 API 调用的请求,以便它返回的错误页面可以更改,具体取决于情况。例如,假设有两个端点: (1) @app.r
我已经编写了一个简短的快速代码来向查找器添加一个按钮,该按钮通过系统 touch 调用在当前目录中创建一个新的空白文件。该扩展可以很好地获取当前目录(通过 FIFinderSyncController
当我运行 hdf namenode -format 时,它想要删除目录 /home/hadoop/hadooptmpdata/dfs/name/current 但它没有权限执行此操作。如何授予它权限?
我正在用 C# 编写一个应用程序(对于我的一个 friend 来说,这是非常基础的),但是我有一个 StreamWriter 对象,它在 C: 中创建一个本地文件。我必须以管理员身份运行,它工作正常,
我已经安装了 Centos5,安装了 Web 服务器并设置了虚拟主机。主机几乎是这样设置的: > adduser user1 > mkdir -p /home/user1/public_html/do
我正从 MySQL 迁移到 PostgreSQL,但在用户权限方面遇到了瓶颈。我习惯于使用以下命令为用户分配对数据库所有表的所有权限: # MySQL grant all privileges on
我试图为特定用户授予对 UNC 路径的 NTFS 权限,但我看到了不同的行为,具体取决于 UNC 路径。下面是我用来授予权限的代码(来自 MSDN)以及每种情况下的结果, static void Gi
我是一名优秀的程序员,十分优秀!