-
Notifications
You must be signed in to change notification settings - Fork 40
Support Azure Front Door #706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhiyuanliang-ms
wants to merge
18
commits into
preview
Choose a base branch
from
zhiyuanliang/afd
base: preview
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c219326
wip
zhiyuanliang-ms 2ebf5a8
wip
zhiyuanliang-ms a9dd87c
wip
zhiyuanliang-ms 85f0306
wip
zhiyuanliang-ms 0ad2a50
fix test
zhiyuanliang-ms d39d468
wip
zhiyuanliang-ms 10e36a9
wip
zhiyuanliang-ms d5b1b64
wip
zhiyuanliang-ms 3049eb3
add test
zhiyuanliang-ms 5d3d2c2
update correlation context
zhiyuanliang-ms f0b8b87
Merge branch 'zhiyuanliang/afd' of https://github.com/Azure/AppConfig…
zhiyuanliang-ms 9363ea8
update
zhiyuanliang-ms 1e2d081
only check response time for refresh trigger engine
zhiyuanliang-ms f0e52bf
disallow sentinel key refresh for AFD
zhiyuanliang-ms a67f9c9
add feature flag refresh test
zhiyuanliang-ms 7ae64eb
update
zhiyuanliang-ms 9db6584
resolve comments
zhiyuanliang-ms bb5d7ff
update
zhiyuanliang-ms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...osoft.Extensions.Configuration.AzureAppConfiguration/Afd/AfdConfigurationClientManager.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
| // | ||
| using Azure.Data.AppConfiguration; | ||
| using Microsoft.Extensions.Azure; | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.Afd | ||
| { | ||
| internal class AfdConfigurationClientManager : IConfigurationClientManager | ||
| { | ||
| private readonly ConfigurationClientWrapper _clientWrapper; | ||
|
|
||
| public AfdConfigurationClientManager( | ||
| IAzureClientFactory<ConfigurationClient> clientFactory, | ||
| Uri endpoint) | ||
| { | ||
| if (clientFactory == null) | ||
| { | ||
| throw new ArgumentNullException(nameof(clientFactory)); | ||
| } | ||
|
|
||
| if (endpoint == null) | ||
| { | ||
| throw new ArgumentNullException(nameof(endpoint)); | ||
| } | ||
|
|
||
| _clientWrapper = new ConfigurationClientWrapper(endpoint, clientFactory.CreateClient(endpoint.AbsoluteUri)); | ||
| } | ||
|
|
||
| public IEnumerable<ConfigurationClient> GetClients() | ||
| { | ||
| return new List<ConfigurationClient> { _clientWrapper.Client }; | ||
| } | ||
|
|
||
| public void RefreshClients() | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| public bool UpdateSyncToken(Uri endpoint, string syncToken) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| public Uri GetEndpointForClient(ConfigurationClient client) | ||
| { | ||
| if (client == null) | ||
| { | ||
| throw new ArgumentNullException(nameof(client)); | ||
| } | ||
|
|
||
| return _clientWrapper.Client == client ? _clientWrapper.Endpoint : null; | ||
| } | ||
| } | ||
| } |
47 changes: 47 additions & 0 deletions
47
src/Microsoft.Extensions.Configuration.AzureAppConfiguration/Afd/AfdPolicy.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
| // | ||
| using Azure.Core; | ||
| using Azure.Core.Pipeline; | ||
| using System; | ||
|
|
||
| namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.Afd | ||
| { | ||
| /// <summary> | ||
| /// HTTP pipeline policy that removes Authorization and Sync-Token headers from outgoing requests. | ||
| /// </summary> | ||
| internal class AfdPolicy : HttpPipelinePolicy | ||
| { | ||
| private const string AuthorizationHeader = "Authorization"; | ||
| private const string SyncTokenHeader = "Sync-Token"; | ||
|
|
||
| /// <summary> | ||
| /// Processes the HTTP message and removes Authorization and Sync-Token headers. | ||
| /// </summary> | ||
| /// <param name="message">The HTTP message.</param> | ||
| /// <param name="pipeline">The pipeline.</param> | ||
| public override void Process(HttpMessage message, ReadOnlyMemory<HttpPipelinePolicy> pipeline) | ||
| { | ||
| message.Request.Headers.Remove(AuthorizationHeader); | ||
|
|
||
| message.Request.Headers.Remove(SyncTokenHeader); | ||
|
|
||
| ProcessNext(message, pipeline); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Processes the HTTP message and removes Authorization and Sync-Token headers. | ||
| /// </summary> | ||
| /// <param name="message">The HTTP message.</param> | ||
| /// <param name="pipeline">The pipeline.</param> | ||
| /// <returns>A task representing the asynchronous operation.</returns> | ||
| public override async System.Threading.Tasks.ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory<HttpPipelinePolicy> pipeline) | ||
| { | ||
| message.Request.Headers.Remove(AuthorizationHeader); | ||
|
|
||
| message.Request.Headers.Remove(SyncTokenHeader); | ||
|
|
||
| await ProcessNextAsync(message, pipeline).ConfigureAwait(false); | ||
| } | ||
| } | ||
| } |
38 changes: 38 additions & 0 deletions
38
src/Microsoft.Extensions.Configuration.AzureAppConfiguration/Afd/EmptyTokenCredential.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
| // | ||
| using Azure.Core; | ||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.Afd | ||
| { | ||
| /// <summary> | ||
| /// A token credential that provides an empty token. | ||
| /// </summary> | ||
| internal class EmptyTokenCredential : TokenCredential | ||
| { | ||
| /// <summary> | ||
| /// Gets an empty token. | ||
| /// </summary> | ||
| /// <param name="requestContext">The context of the token request.</param> | ||
| /// <param name="cancellationToken">A cancellation token to cancel the operation.</param> | ||
| /// <returns>An empty access token.</returns> | ||
| public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
| { | ||
| return new AccessToken(string.Empty, DateTimeOffset.MaxValue); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Asynchronously gets an empty token. | ||
| /// </summary> | ||
| /// <param name="requestContext">The context of the token request.</param> | ||
| /// <param name="cancellationToken">A cancellation token to cancel the operation.</param> | ||
| /// <returns>A task that represents the asynchronous operation. The task result contains an empty access token.</returns> | ||
| public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) | ||
| { | ||
| return new ValueTask<AccessToken>(new AccessToken(string.Empty, DateTimeOffset.MaxValue)); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.