本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Queue.CloudQueue.GetSharedAccessSignature方法的典型用法代码示例。如果您正苦于以下问题:C# CloudQueue.GetSharedAccessSignature方法的具体用法?C# CloudQueue.GetSharedAccessSignature怎么用?C# CloudQueue.GetSharedAccessSignature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Queue.CloudQueue
的用法示例。
在下文中一共展示了CloudQueue.GetSharedAccessSignature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RequestSasToken
static string RequestSasToken(CloudQueue queue)
{
// Omitting any authentication code since this is beyond the scope of
// this sample code
// creating a shared access policy that expires in 1 day.
// No start time is specified, which means that the token is valid immediately.
// The policy specifies full permissions.
SharedAccessQueuePolicy policy = new SharedAccessQueuePolicy()
{
SharedAccessStartTime = DateTime.UtcNow.AddMinutes(-15),
SharedAccessExpiryTime = DateTime.UtcNow.AddDays(1.0),
Permissions = SharedAccessQueuePermissions.Add |
SharedAccessQueuePermissions.Read |
SharedAccessQueuePermissions.Update |
SharedAccessQueuePermissions.ProcessMessages
};
// Generate the SAS token. No access policy identifier is used which
// makes it a non-revocable token
// limiting the table SAS access to only the request customer's id
string sasToken = queue.GetSharedAccessSignature(policy);
return sasToken;
}