Skip to content

Commit 1f5e45e

Browse files
committed
Addressing comments
1 parent 4d83fe0 commit 1f5e45e

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

articles/azure-app-configuration/feature-management-dotnet-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Here are some of the benefits of using .NET feature management library:
4343
The .NET feature management library is open source. For more information, visit the [GitHub repo](https://github.com/microsoft/FeatureManagement-Dotnet).
4444

4545
## Feature Flags
46-
Feature flags have a name and can be either enabled or disabled. The state of a flag can be made conditional through the use of feature filters.
46+
Feature flags can be either enabled or disabled. The state of a flag can be made conditional through the use of feature filters.
4747

4848
### Feature Filters
4949
Feature filters define a scenario for when a feature should be enabled. When a feature is evaluated as on or off, its list of feature filters are traversed until one of the filters determines the feature is enabled. At this point, traversal through the feature filters stops. If no feature filter indicates that the feature should be enabled, it is considered disabled.

articles/azure-app-configuration/howto-targetingfilter-aspnet-core.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,11 @@ In this section, you create a web application that allows users to sign in and u
199199
200200
## Enable targeting for the web application
201201
202-
The targeting filter evaluates a user's feature state based on the user's targeting context, which comprises the user ID and the groups the user belongs to. In this example, you can use the signed-in user's email address as the user ID and the domain name of the email address as the group.
202+
A targeting context is required for feature evaluation with targeting. You can provide it as a parameter to the `featureManager.IsEnabledAsync` API explicitly. In ASP.NET Core, the targeting context can also be provided through the service collection as an ambient context by implementing the [ITargetingContextAccessor](./feature-management-dotnet-reference.md#itargetingcontextaccessor) interface.
203203
204-
To evaluate features that use targeting without the need to manually pass a targeting context, an [ITargetingContextAccessor](./feature-management-dotnet-reference.md#itargetingcontextaccessor) can be used.
204+
### Targeting Context Accessor
205205
206-
### Default Targeting Accessor
207-
208-
To add the default implementation of `ITargetingContextAccessor` use the `WithTargeting()` extension on the feature management builder as seen below. The default uses `HttpContext.User.Identity.Name` as `UserId` and uses `HttpContext.User.Claims` of type `Role` for `Groups`. You can see how the accessor works by looking at the [DefaultHttpTargetingContextAccessor](https://github.com/microsoft/FeatureManagement-Dotnet/blob/main/src/Microsoft.FeatureManagement.AspNetCore/DefaultHttpTargetingContextAccessor.cs).
206+
To provide the targeting context, pass your implementation type of the `ITargetingContextAccessor` to the `WithTargeting<T>` method. If no type is provided, a default implementation is used, as shown in the following code snippet. The default targeting context accessor utilizes `HttpContext.User.Identity.Name` as `UserId` and uses `HttpContext.User.Claims` of type [`Role`](https://learn.microsoft.com/dotnet/api/system.security.claims.claimtypes.role?view=net-9.0#system-security-claims-claimtypes-role) for `Groups`. You can reference the [DefaultHttpTargetingContextAccessor](https://github.com/microsoft/FeatureManagement-Dotnet/blob/main/src/Microsoft.FeatureManagement.AspNetCore/DefaultHttpTargetingContextAccessor.cs) to implement your own if customization is needed. To learn more about implementing the [ITargetingContextAccessor](./feature-management-dotnet-reference.md#itargetingcontextaccessor), see the feature reference for targeting.
209207
210208
``` C#
211209
// Existing code in Program.cs
@@ -219,9 +217,6 @@ builder.Services.AddFeatureManagement()
219217
// ... ...
220218
```
221219

222-
> [!NOTE]
223-
> For more control over how username and groups are extracted for targeting, see the [feature reference for targeting](./feature-management-dotnet-reference.md#itargetingcontextaccessor).
224-
225220
## Targeting filter in action
226221

227222
1. Build and run the application. Initially, the **Beta** item doesn't appear on the toolbar, because the _Default percentage_ option is set to 0.

0 commit comments

Comments
 (0)