@@ -2516,6 +2516,17 @@ namespace azure { namespace storage {
25162516 friend class protocol::list_containers_reader;
25172517 };
25182518
2519+ struct user_delegation_key
2520+ {
2521+ utility::string_t signed_oid;
2522+ utility::string_t signed_tid;
2523+ utility::datetime signed_start;
2524+ utility::datetime signed_expiry;
2525+ utility::string_t signed_service;
2526+ utility::string_t signed_version;
2527+ utility::string_t key;
2528+ };
2529+
25192530 /// <summary>
25202531 /// Provides a client-side logical representation of the Windows Azure Blob Service. This client is used to configure and execute requests against the Blob Service.
25212532 /// </summary>
@@ -3064,6 +3075,39 @@ namespace azure { namespace storage {
30643075 m_directory_delimiter = std::move(value);
30653076 }
30663077
3078+ /// <summary>
3079+ /// Gets a key that can be used to sign a user delegation SAS (shared access signature).
3080+ /// </summary>
3081+ /// <param name="start">The start time for the user delegation key.</param>
3082+ /// <param name="expiry">The expiry time for the user delegation key.</param>
3083+ /// <returns>A string containing user delegation key.</returns>
3084+ user_delegation_key get_user_delegation_key(const utility::datetime& start, const utility::datetime& expiry)
3085+ {
3086+ return get_user_delegation_key_async(start, expiry).get();
3087+ }
3088+
3089+ /// <summary>
3090+ /// Initiates an asynchronous operation to get a key that can be used to sign a user delegation SAS (shared access signature).
3091+ /// </summary>
3092+ /// <param name="start">The start time for the user delegation key.</param>
3093+ /// <param name="expiry">The expiry time for the user delegation key.</param>
3094+ /// <returns>A <see cref="pplx::task" /> object of string that contains user delegation key.</returns>
3095+ pplx::task<user_delegation_key> get_user_delegation_key_async(const utility::datetime& start, const utility::datetime& expiry)
3096+ {
3097+ return get_user_delegation_key_async(start, expiry, blob_request_options(), operation_context(), pplx::cancellation_token::none());
3098+ }
3099+
3100+ /// <summary>
3101+ /// Initiates an asynchronous operation to get a key that can be used to sign a user delegation SAS (shared access signature).
3102+ /// </summary>
3103+ /// <param name="start">The start time for the user delegation key.</param>
3104+ /// <param name="expiry">The expiry time for the user delegation key.</param>
3105+ /// <param name="options">An <see cref="azure::storage::blob_request_options" /> object that specifies additional options for the request.</param>
3106+ /// <param name="context">An <see cref="azure::storage::operation_context" /> object that represents the context for the current operation.</param>
3107+ /// <param name="cancellation_token">An <see cref="pplx::cancellation_token" /> object that is used to cancel the current operation.</param>
3108+ /// <returns>A <see cref="pplx::task" /> object of string that contains user delegation key.</returns>
3109+ WASTORAGE_API pplx::task<user_delegation_key> get_user_delegation_key_async(const utility::datetime& start, const utility::datetime& expiry, const request_options& modified_options, operation_context context, const pplx::cancellation_token& cancellation_token);
3110+
30673111 private:
30683112 pplx::task<account_properties> download_account_properties_base_async(const storage_uri& uri, const request_options& modified_options, operation_context context, const pplx::cancellation_token& cancellation_token) const;
30693113
@@ -3175,6 +3219,14 @@ namespace azure { namespace storage {
31753219 /// <returns>A string containing a shared access signature.</returns>
31763220 WASTORAGE_API utility::string_t get_shared_access_signature(const blob_shared_access_policy& policy, const utility::string_t& stored_policy_identifier) const;
31773221
3222+ /// <summary>
3223+ /// Returns a user delegation SAS for the container.
3224+ /// </summary>
3225+ /// <param name="key">User delegation key used to sign this SAS.</param>
3226+ /// <param name="policy">The access policy for the shared access signature.</param>
3227+ /// <returns>A string containing a shared access signature.</returns>
3228+ WASTORAGE_API utility::string_t get_user_delegation_sas(const user_delegation_key& key, const blob_shared_access_policy& policy) const;
3229+
31783230 /// <summary>
31793231 /// Gets a reference to a blob in this container.
31803232 /// </summary>
@@ -4612,6 +4664,27 @@ namespace azure { namespace storage {
46124664 /// <returns>A string containing a shared access signature.</returns>
46134665 WASTORAGE_API utility::string_t get_shared_access_signature(const blob_shared_access_policy& policy, const utility::string_t& stored_policy_identifier, const cloud_blob_shared_access_headers& headers) const;
46144666
4667+
4668+ /// <summary>
4669+ /// Returns a user delegation SAS for the blob.
4670+ /// </summary>
4671+ /// <param name="key">User delegation key used to sign this SAS.</param>
4672+ /// <param name="policy">The access policy for the shared access signature.</param>
4673+ /// <returns>A string containing a shared access signature.</returns>
4674+ utility::string_t get_user_delegation_sas(const user_delegation_key& key, const blob_shared_access_policy& policy) const
4675+ {
4676+ return get_user_delegation_sas(key, policy, cloud_blob_shared_access_headers());
4677+ }
4678+
4679+ /// <summary>
4680+ /// Returns a user delegation SAS for the blob.
4681+ /// </summary>
4682+ /// <param name="key">User delegation key used to sign this SAS.</param>
4683+ /// <param name="policy">The access policy for the shared access signature.</param>
4684+ /// <param name="headers">The optional header values to set for a blob returned with this SAS.</param>
4685+ /// <returns>A string containing a shared access signature.</returns>
4686+ WASTORAGE_API utility::string_t get_user_delegation_sas(const user_delegation_key& key, const blob_shared_access_policy& policy, const cloud_blob_shared_access_headers& headers) const;
4687+
46154688 /// <summary>
46164689 /// Opens a stream for reading from the blob.
46174690 /// </summary>
0 commit comments