| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 3 | | // license information. |
| | 4 | |
|
| | 5 | | using System.Net.Http; |
| | 6 | | using System.Threading; |
| | 7 | | using System.Threading.Tasks; |
| | 8 | | using Microsoft.Rest; |
| | 9 | |
|
| | 10 | | namespace Microsoft.Azure.EventGrid.Models |
| | 11 | | { |
| | 12 | | public class ResourceCredentials : ServiceClientCredentials |
| | 13 | | { |
| | 14 | | readonly string resourceKey; |
| | 15 | |
|
| 2 | 16 | | public ResourceCredentials(string resourceKey) |
| | 17 | | { |
| 2 | 18 | | this.resourceKey = resourceKey; |
| 2 | 19 | | } |
| | 20 | |
|
| | 21 | | public override void InitializeServiceClient<T>(ServiceClient<T> client) |
| | 22 | | { |
| 2 | 23 | | } |
| | 24 | |
|
| | 25 | | public override async Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationTok |
| | 26 | | { |
| 2 | 27 | | request.Headers.Add("aeg-sas-key", this.resourceKey); |
| 2 | 28 | | await base.ProcessHttpRequestAsync(request, cancellationToken).ConfigureAwait(false); |
| 2 | 29 | | } |
| | 30 | | } |
| | 31 | | } |