microsoft/FeatureManagement-Dotnet

Targeting should support claims on top of existing user id & group targeting

Opened this issue · 0 comments

The targeting filter supports targeting specific users and groups. Sometimes a user may carry targetable information that is not a group. For example location and user agent. Targeting should be able to act on this information.

With this approach, group targeting can be viewed as a subset of claim targeting where the claim name is "Group".

Proposal

Add IEnumerable<Claim> to TargetingContext

class TargetingContext
{
    string UserId { get; set; }

    IEnumerable<string> Groups { get; set; }

    IEnumerable<Claim> Claims { get; set; }
}

class Claim
{
    string Name { get; set; }

    string Value { get; set; }
}

Update targeting parameters to support claim targeting.

{
    "MyFeature": {
        "EnabledFor": [
            {
                "Name": "Targeting",
                "Parameters": {
                    "Audience": {
                        "Claims": [
                            "Name": "Location",
                            "Value": "East US",
                            "RolloutPercentage": 20
                        ]
                    }
                }
            }
        ]
    }
}

In the aforementioned example, 20% of users with that have a claim with name Location and value East US will be targeted.

Exclusion

Additionally, exclusion should be supported based on claims.