gpt4 book ai didi

security - 如何设置 Azure 队列的共享访问策略?

转载 作者:行者123 更新时间:2023-12-03 06:05:02 26 4
gpt4 key购买 nike

显然可以使用共享访问策略来控制对 Azure 队列的访问。这里的例子http://msdn.microsoft.com/en-us/library/windowsazure/hh508996证实了这一点,但随后仅提供了 blob 共享访问策略的示例。有没有人有关于如何为队列(和表)实现相同目的的任何引用?

最佳答案

您可以在 Windows Azure 存储博客上找到完整的示例:Introducing Table SAS (Shared Access Signature), Queue SAS and update to Blob SAS 。以下是将策略分配给队列的部分:

// Create the GC queue SAS policy.
QueuePermissions gcQueuePermissions = new QueuePermissions();
SharedAccessQueuePolicy gcQueuePolicy = new SharedAccessQueuePolicy()
{
// Providing the max duration
SharedAccessExpiryTime = DateTime.MaxValue,
// Permission is granted to process queue messages.
Permissions = SharedAccessQueuePermissions.ProcessMessages
};

// Associate the above policy with a signed identifier
gcQueuePermissions.SharedAccessPolicies.Add(
gcPolicySignedIdentifier,
gcQueuePolicy);

// The below call will result in a Set Queue ACL request to be sent to
// Windows Azure Storage in order to store the policy and associate it with the
// "GCAccessPolicy" signed identifier that will be referred to
// by the generated SAS token
this.gcQueue.SetPermissions(gcQueuePermissions);

关于security - 如何设置 Azure 队列的共享访问策略?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12302001/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com