- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我能够CreateContainers、ListContainers、ListBlobs,但是当我尝试发出PUT/DELETE
请求来上传或时>删除 Azure 存储 blob 中的文件,但发出请求后显示以下错误:
403
This request is not authorized to perform this operation using this permission.
{
'content-length': '279',
'content-type': 'application/xml',
server: 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '4de6c154-f01e-0051-7ce4-1314ef000000',
'x-ms-version': '2018-03-28',
'x-ms-error-code': 'AuthorizationPermissionMismatch',
date: 'Mon, 08 Mar 2021 06:32:44 GMT',
connection: 'close'
}
上传/PUT
文件的代码是:
const request = require("request");
require("dotenv").config();
const account = process.env.ACCOUNT_NAME || "";
const containerName = "demo";
const blobName = "dummyfile1.txt";
const blobContent = "Hello, This will be written in file";
const contentLength = new TextEncoder().encode(blobContent).length;
var strTime = new Date().toUTCString();
const options = {
url: `https://${account}.blob.core.windows.net/${containerName}/${blobName}`,
headers: {
Authorization: "Bearer <BearerToken>",
"x-ms-date": strTime,
"x-ms-version": "2018-03-28",
"x-ms-blob-type": "BlockBlob",
"Content-Length": contentLength,
"Content-Type": 'application/text-plain',
},
body: blobContent,
};
function callback(error, response, body) {
console.log(response.statusCode);
console.log(response.statusMessage);
console.log(response.headers);
}
request.put(options, callback);
在这里,我手动替换我通过 POSTMAN 获取的内容:
此外,我已向应用程序添加了存储数据贡献者的权限:
我已将 Azure 存储、user_impersonation 权限也委托(delegate)给了该应用程序。
但是,同样的错误仍然存在。
最佳答案
当使用auth code flow时,您的登录用户需要 Azure 存储的权限。使用时Storage Blob Data Contributor
Angular 色,您需要将 Angular 色分配添加到您的帐户,而不是应用程序(只有客户端凭据流程需要应用程序 Angular 色)。
然后将 Azure 存储权限添加到 API 权限。
此外,https://<account-name>.blob.core.windows.net/user_impersonation
和https://storage.azure.com/user_impersonation
可用于范围。有关 Azure 存储资源 ID(范围)的更多详细信息,请参阅 here .
https://${account}.blob.core.windows.net/.default
或https://storage.azure.com/.default
适用于客户端凭据流程。
步骤:
注意:登录 Azure 帐户后,您应该接受请求的权限。
https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/authorize?
client_id={client-id}
&response_type=code
&redirect_uri=https://localhost:44300/
&response_mode=query
&scope=https://{account}.blob.core.windows.net/user_impersonation
&state=12345
&prompt=consent
aud
,看起来像 https://xxxx.blob.core.windows.net
.关于javascript - 尝试使用 AD token /承载 token [Azure-Blob][承载 token ] 将文件放入 Azure Blob 中时授权权限不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66525481/
我能够CreateContainers、ListContainers、ListBlobs,但是当我尝试发出PUT/DELETE请求来上传或时>删除 Azure 存储 blob 中的文件,但发出请求后显
我想验证从浏览器应用程序传递过来的 API 中的不记名 token 。 API 将通过调用 ../userinfo 端点来验证针对 Keycloak 的 token ,如果检查运行正常,则以所需的内容
大家好,我正在关注 azure 的下一个教程: https://learn.microsoft.com/en-us/rest/api/apimanagement/current-ga/subscrip
我们即将开始集成测试我们的 REST API,这些 API 使用 ADAL.js/不记名 token /passport-azure-ad 进行保护。 现在讨论实际问题,在自动化测试中,我将如何获取不
我们即将开始集成测试我们的 REST API,这些 API 使用 ADAL.js/不记名 token /passport-azure-ad 进行保护。 现在讨论实际问题,在自动化测试中,我将如何获取不
我正在尝试通过 Javascript 将授权 token 承载发送到 REST 端点,所以我这样做: $.ajax( { url: 'http://localhost:8080/resourc
我有一个用于 SSO 的 .NET Core IdentityServer (IS),我想用它来对我的 .NET Core(后端)-Angular(客户端)应用程序进行身份验证。我希望在后端有一个 E
我需要为我的 API 发送我的 token 。我将我的 token 保存在 SharedPreferences 中,我可以恢复它。我的 API 需要一个,与 Bearer 但怎么办? 我测试了授权、H
根据RFC6750 -OAuth 2.0授权框架:不记名 token 使用,不记名 token 是: A security token with the property that any party
我们使用 Angular、.Net WebApi 和 Azure 构建多个应用程序。我们一直在做的是通过隐式 oAuth2/OIDC 授权流程通过 Azure AD 保护应用程序。 一切进展顺利,但到
使用 Owin + Oauth2 + Identity2。 我有一个带有默认基本身份验证设置的 web Api,我已对其进行修改。 我的 startup.cs 部分类 public void Conf
我的应用程序有一个自定义窗口设计,这意味着每个窗口都有以下参数集 (XAML):WindowStyle="无"AllowsTransparency="假" 其中一个子窗口需要显示一个 Flash 组件
我们正在开发具有 JWT Bearer 身份验证的 .Net Core 2.1 Web API。应用程序本身将生成并分发要发送到后端的 token 。 虽然我们已启动并运行所有内容,即我们可以从 An
我有带有 OWIN 管道的 ASP.NET 4.5 服务,它发出 OAuth access_token 以换取用户名/密码。该服务从 ng-app 调用,一旦它获得 token ,就会存储在浏览器的本
我有一个使用 Azure Active Directory 的 Java 后端应用程序。我正在使用 oauth2 不记名 token 登录。在后端,我正在搜索并使用 oauth2 属性“preferr
上周我为现有 MVC 应用程序创建了一个 API,现在正在尝试保护 API 并根据需要重新设计 MVC 端安全性。 目前,MVC 应用程序设置为通过 OWIN/OAuth/Identity 使用应用程
背景 我已经实现了 Thinktecture.IdentityServer.V3(openID Connect 之一)。我已将 OAuth2 承载 token 以以下形式返回到我的 javascrip
我不明白为什么这不起作用。我假设这是我忽略的简单事情。所有其他不使用 token 的测试方法都可以正常工作。目前 token 没有过期时间,我可以通过 Postman 很好地使用它。 @Test pu
在使用 passport 和 oauth2orize 实现 oauth2 堆栈时,在这种情况下,问题特别在于使用 oauth2orize jwt 承载。 oauth2orize jwt bearer
我正在我的 .NET Web 应用程序中实现 Web API 2 服务架构。消费请求的客户端是纯 javascript,没有 mvc/asp.net。我正在使用 OWIN 尝试根据本文 OWIN Be
我是一名优秀的程序员,十分优秀!